CN109872294A - Image processing method, device, terminal and storage medium - Google Patents

Image processing method, device, terminal and storage medium Download PDF

Info

Publication number
CN109872294A
CN109872294A CN201910202918.7A CN201910202918A CN109872294A CN 109872294 A CN109872294 A CN 109872294A CN 201910202918 A CN201910202918 A CN 201910202918A CN 109872294 A CN109872294 A CN 109872294A
Authority
CN
China
Prior art keywords
image
byte
threshold
ratio
volume
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910202918.7A
Other languages
Chinese (zh)
Other versions
CN109872294B (en
Inventor
殷勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN201910202918.7A priority Critical patent/CN109872294B/en
Publication of CN109872294A publication Critical patent/CN109872294A/en
Application granted granted Critical
Publication of CN109872294B publication Critical patent/CN109872294B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The disclosure is directed to a kind of image processing method, device, terminal and storage mediums, belong to field of image processing.The described method includes: determining that the diminution ratio of image carries out diminution processing to described image, obtain the first image according to the diminution ratio;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;Detect the byte volume of the first image;When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment parameter of the first image is determined, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte-threshold;According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.Using the disclosure, the efficiency for uploading image can be improved.

Description

Image processing method, device, terminal and storage medium
Technical field
This disclosure relates to field of image processing more particularly to a kind of image processing method, device, terminal and storage medium.
Background technique
Lasting pursuit with the fast development and industry of browser technology to Web richness interactive means, front end field exists More and more duties are carried in application program based on BS (Browser and Server, browser and server) framework Appoint, among these just includes the processing to image is uploaded, such as the legitimacy of check image.
The legitimacy of image include the byte volume of image be less than the byte-threshold of browser, the type of image meet it is default Type etc..If the byte volume for the image that user uploads is greater than the byte-threshold of browser, browser can determine whether that image does not conform to Method issues the user with prompt information, and user is prompted to upload the image of byte small volume again.At this moment, user needs drop manually Then the byte volume of low image uploads again, until the byte volume of image is less than the byte-threshold of browser, could complete The upload of image, complicated operation, so that the efficiency for uploading image is lower.
Summary of the invention
The disclosure provides a kind of image processing method, device, terminal and storage medium, can solve the efficiency for uploading image Lower problem.
According to the first aspect of the embodiments of the present disclosure, a kind of image processing method is provided, comprising:
The diminution ratio for determining image carries out diminution processing to described image, obtains the first figure according to the diminution ratio Picture;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detect the byte volume of the first image;
When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment ginseng of the first image is determined Number, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte-threshold;
According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.
Optionally, the diminution ratio of the determining image, comprising:
According to the original width and original height of described image, original the ratio of width to height of described image is determined;
If described original the ratio of width to height is greater than first the ratio of width to height, by the ratio of the original height and the first height, really It is set to the diminution ratio of described image, described first the ratio of width to height is the ratio of the first width and the first height;
If described original the ratio of width to height is less than or equal to first the ratio of width to height, by the ratio of the original width and the first width Value, is determined as the diminution ratio of described image.
Optionally, the Mass adjust- ment parameter of the determining the first image, comprising:
According to the byte-threshold, the maximum value of Mass adjust- ment parameter and minimum value, every time the Mass adjust- ment ginseng determined The byte volume of corresponding first image of number, repeatedly determines the Mass adjust- ment parameter of the first image, until the matter determined The byte volume for measuring corresponding first image of adjusting parameter is equal to the byte-threshold.
Optionally, described according to the byte-threshold, the maximum value of Mass adjust- ment parameter and minimum value, every time to determine The byte volume of corresponding first image of Mass adjust- ment parameter repeatedly determines the Mass adjust- ment parameter of the first image, until The byte volume of corresponding first image of the Mass adjust- ment parameter determined is equal to the byte-threshold, comprising:
Determine the mean value of the maxima and minima of Mass adjust- ment parameter;
The first image is carried out according to the mean value to reduce picture quality processing;
When the byte volume of treated image is greater than the byte-threshold, Mass adjust- ment ginseng is updated according to the mean value Several maximum values goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is less than the byte-threshold, Mass adjust- ment ginseng is updated according to the mean value Several minimum values goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as Mass adjust- ment ginseng Number.
Optionally, the method also includes:
When the byte volume of the first image is less than the byte-threshold, the amplification ratio of the first image is determined Example, the magnification ratio meet byte-threshold for the first image to be amplified to;
According to the magnification ratio, processing is amplified to the first image.
Optionally, the magnification ratio of the determining the first image, comprising:
The magnification ratio determined according to the byte-threshold, the maximum value of magnification ratio and minimum value and every time is corresponding The first image byte volume, the magnification ratio of the first image is repeatedly determined, until the magnification ratio determined is corresponding The first image byte volume be equal to the byte-threshold.
Optionally, described according to the byte-threshold, the maximum value of magnification ratio and minimum value and every time to determine The byte volume of corresponding first image of magnification ratio repeatedly determines the magnification ratio of the first image, until what is determined The byte volume of corresponding first image of magnification ratio is equal to the byte-threshold, comprising:
Determine the mean value of the maxima and minima of magnification ratio;
Processing is amplified to the first image according to the mean value;
When the byte volume of treated image is greater than the byte-threshold, magnification ratio is updated according to the mean value Maximum value goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is less than the byte-threshold, magnification ratio is updated according to the mean value Minimum value goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as magnification ratio.
Optionally, the byte-threshold is byte-threshold range;
The byte volume of treated the image is greater than the byte volume of the byte-threshold image that includes that treated Greater than the maximum value of the byte-threshold range;
The byte volume of treated the image is less than the byte volume of the byte-threshold image that includes that treated Less than the minimum value of the byte-threshold range;
The byte volume of treated the image is equal to the byte volume of the byte-threshold image that includes that treated Within the scope of the byte-threshold.
Optionally, the picture quality for reducing the first image, comprising:
Reduce the clarity of the first image.
According to the second aspect of an embodiment of the present disclosure, a kind of image processing apparatus is provided, comprising:
Reducing unit, according to the diminution ratio, carries out at diminution described image for determining the diminution ratio of image Reason, obtains the first image;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detection unit, for detecting the byte volume of the first image;
Determination unit determines the matter of the first image when the byte volume of the first image is greater than byte-threshold Adjusting parameter is measured, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte Threshold value;
Unit is reduced, for reducing the picture quality of the first image according to the Mass adjust- ment parameter.
Optionally, the reducing unit, is used for:
According to the original width and original height of described image, original the ratio of width to height of described image is determined;
If described original the ratio of width to height is greater than first the ratio of width to height, by the ratio of the original height and the first height, really It is set to the diminution ratio of described image, described first the ratio of width to height is the ratio of the first width and the first height;
If described original the ratio of width to height is less than or equal to first the ratio of width to height, by the ratio of the original width and the first width Value, is determined as the diminution ratio of described image.
Optionally, the determination unit, is used for:
According to the byte-threshold, the maximum value of Mass adjust- ment parameter and minimum value, every time the Mass adjust- ment ginseng determined The byte volume of corresponding first image of number, repeatedly determines the Mass adjust- ment parameter of the first image, until the matter determined The byte volume for measuring corresponding first image of adjusting parameter is equal to the byte-threshold.
Optionally, the determination unit, is used for:
Determine the mean value of the maxima and minima of Mass adjust- ment parameter;
The first image is carried out according to the mean value to reduce picture quality processing;
When the byte volume of treated image is greater than the byte-threshold, Mass adjust- ment ginseng is updated according to the mean value Several maximum values goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is less than the byte-threshold, Mass adjust- ment ginseng is updated according to the mean value Several minimum values goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as Mass adjust- ment ginseng Number.
Optionally,
The determination unit is also used to determine institute when the byte volume of the first image is less than the byte-threshold The magnification ratio of the first image is stated, the magnification ratio meets byte-threshold for the first image to be amplified to;
Amplifying unit, for amplifying processing to the first image according to the magnification ratio.
Optionally, the determination unit, is used for:
The magnification ratio determined according to the byte-threshold, the maximum value of magnification ratio and minimum value and every time is corresponding The first image byte volume, the magnification ratio of the first image is repeatedly determined, until the magnification ratio determined is corresponding The first image byte volume be equal to the byte-threshold.
Optionally, the determination unit, is used for:
Determine the mean value of the maxima and minima of magnification ratio;
Processing is amplified to the first image according to the mean value;
When the byte volume of treated image is greater than the byte-threshold, magnification ratio is updated according to the mean value Maximum value goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is less than the byte-threshold, magnification ratio is updated according to the mean value Minimum value goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as magnification ratio.
Optionally, the byte-threshold is byte-threshold range;
The byte volume of treated the image is greater than the byte volume of the byte-threshold image that includes that treated Greater than the maximum value of the byte-threshold range;
The byte volume of treated the image is less than the byte volume of the byte-threshold image that includes that treated Less than the minimum value of the byte-threshold range;
The byte volume of treated the image is equal to the byte volume of the byte-threshold image that includes that treated Within the scope of the byte-threshold.
Optionally, the reduction unit, is used for:
Reduce the clarity of the first image.
According to the third aspect of an embodiment of the present disclosure, a kind of terminal is provided, comprising:
Processor;
Memory for storage processor executable instruction;
Wherein, the processor is configured to:
The diminution ratio for determining image carries out diminution processing to described image, obtains the first figure according to the diminution ratio Picture;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detect the byte volume of the first image;
When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment ginseng of the first image is determined Number, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte-threshold;
According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.
According to a fourth aspect of embodiments of the present disclosure, a kind of non-transitorycomputer readable storage medium is provided, when described When instruction in storage medium is executed by the processor of terminal, enable the terminal to execute a kind of image processing method, the side Method includes:
The diminution ratio for determining image carries out diminution processing to described image, obtains the first figure according to the diminution ratio Picture;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detect the byte volume of the first image;
When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment ginseng of the first image is determined Number, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte-threshold;
According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.
According to a fifth aspect of the embodiments of the present disclosure, a kind of application program is provided, when application program terminal at runtime, So that terminal executes a kind of image processing method, which comprises
The diminution ratio for determining image carries out diminution processing to described image, obtains the first figure according to the diminution ratio Picture;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detect the byte volume of the first image;
When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment ginseng of the first image is determined Number, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte-threshold;
According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.
The technical scheme provided by this disclosed embodiment can include the following benefits:
In the embodiment of the present disclosure, terminal carries out diminution processing to image, obtains the first image, the first image detected Byte volume, if the byte volume of the first image be greater than byte-threshold, terminal according to the Mass adjust- ment of the first image join Number reduces the picture quality of the first image, so that the byte volume for reducing the image that picture quality obtains meets byte-threshold.This The byte body for reducing image is manually operated without user when the byte volume for the image that user uploads is greater than byte-threshold for sample Product reduces byte volume to image automatically by terminal, and it is convenient to operate, and the efficiency for uploading image can be improved.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not The disclosure can be limited.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows the implementation for meeting the disclosure Example, and together with specification for explaining the principles of this disclosure.
Fig. 1 is a kind of image processing method flow chart shown according to an exemplary embodiment.
Fig. 2 is a kind of image processing method flow chart shown according to an exemplary embodiment.
Fig. 3 is a kind of image procossing interface schematic diagram shown according to an exemplary embodiment.
Fig. 4 is a kind of image procossing schematic diagram of a scenario shown according to an exemplary embodiment.
Fig. 5 is a kind of image procossing schematic diagram shown according to an exemplary embodiment.
Fig. 6 is a kind of image procossing schematic diagram shown according to an exemplary embodiment.
Fig. 7 is a kind of image procossing schematic diagram shown according to an exemplary embodiment.
Fig. 8 is a kind of image procossing schematic diagram shown according to an exemplary embodiment.
Fig. 9 is a kind of image procossing schematic diagram shown according to an exemplary embodiment.
Figure 10 is a kind of image processing apparatus block diagram shown according to an exemplary embodiment.
Figure 11 is a kind of structural block diagram of terminal shown according to an exemplary embodiment.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all implementations consistent with this disclosure.On the contrary, they be only with it is such as appended The example of the consistent device and method of some aspects be described in detail in claims, the disclosure.
Fig. 1 is a kind of flow chart of image processing method shown according to an exemplary embodiment, as shown in Figure 1, the party Method is for including the following steps in terminal.
In a step 101, the diminution ratio for determining image carries out diminution processing to the image, obtains according to the diminution ratio To the first image;The diminution ratio is used to indicate the image down to the first width of satisfaction and the first height.
In a step 102, the byte volume of first image is detected.
In step 103, when the byte volume of first image is greater than byte-threshold, the quality of first image is determined Adjusting parameter, which, which is used to indicate, adjusts the byte volume of first image to meeting the byte-threshold.
At step 104, according to the Mass adjust- ment parameter, the picture quality of first image is reduced.
Optionally it is determined that the diminution ratio of image, comprising:
According to the original width and original height of the image, original the ratio of width to height of the image is determined;
The ratio of the original height and the first height is determined as if the original the ratio of width to height is greater than first the ratio of width to height The diminution ratio of the image, first the ratio of width to height are the ratio of the first width and the first height;
If the original the ratio of width to height is less than or equal to first the ratio of width to height, by the ratio of the original width and the first width, It is determined as the diminution ratio of the image.
Optionally it is determined that the Mass adjust- ment parameter of first image, comprising:
According to the byte-threshold, the maximum value of Mass adjust- ment parameter and minimum value, every time the Mass adjust- ment parameter determined The byte volume of corresponding first image repeatedly determines the Mass adjust- ment parameter of first image, until the quality tune determined The byte volume of corresponding first image of whole parameter is equal to the byte-threshold.
Optionally, the quality tune determined according to the byte-threshold, the maximum value of Mass adjust- ment parameter and minimum value, every time The byte volume of corresponding first image of whole parameter, repeatedly determines the Mass adjust- ment parameter of first image, until what is determined The byte volume of corresponding first image of Mass adjust- ment parameter is equal to the byte-threshold, comprising:
Determine the mean value of the maxima and minima of Mass adjust- ment parameter;
First image is carried out according to the mean value to reduce picture quality processing;
When the byte volume of treated image is greater than the byte-threshold, Mass adjust- ment parameter is updated according to the mean value Maximum value goes to the processing for executing the mean value of maxima and minima of the determination Mass adjust- ment parameter;
When the byte volume of treated image is less than the byte-threshold, Mass adjust- ment parameter is updated according to the mean value Minimum value goes to the processing for executing the mean value of maxima and minima of the determination Mass adjust- ment parameter;
When the byte volume of treated image is equal to the byte-threshold, which is determined as Mass adjust- ment parameter.
Optionally, this method further include:
When the byte volume of first image is less than the byte-threshold, the magnification ratio of first image is determined, this is put Large scale meets byte-threshold for first image to be amplified to;
According to the magnification ratio, processing is amplified to first image.
Optionally it is determined that the magnification ratio of first image, comprising:
The magnification ratio determined according to the byte-threshold, the maximum value of magnification ratio and minimum value and every time is corresponding The byte volume of first image, repeatedly determines the magnification ratio of first image, until the magnification ratio determined corresponding The byte volume of one image is equal to the byte-threshold.
Optionally, the amplification ratio determined according to the byte-threshold, the maximum value of magnification ratio and minimum value and every time The byte volume of corresponding first image of example, repeatedly determines the magnification ratio of first image, until the magnification ratio determined The byte volume of corresponding first image is equal to the byte-threshold, comprising:
Determine the mean value of the maxima and minima of magnification ratio;
Processing is amplified to first image according to the mean value;
When the byte volume of treated image is greater than the byte-threshold, the maximum of magnification ratio is updated according to the mean value Value goes to the processing for executing the mean value of maxima and minima of the determination magnification ratio;
When the byte volume of treated image is less than the byte-threshold, the minimum of magnification ratio is updated according to the mean value Value goes to the processing for executing the mean value of maxima and minima of the determination magnification ratio;
When the byte volume of treated image is equal to the byte-threshold, which is determined as magnification ratio.
Optionally, byte-threshold is byte-threshold range;
The byte volume that the byte volume of treated the image is greater than the byte-threshold image that includes that treated is greater than The maximum value of the byte-threshold range;
The byte volume that the byte volume of treated the image is less than the byte-threshold image that includes that treated is less than The minimum value of the byte-threshold range;
The byte volume of treated the image is equal to the byte volume of the byte-threshold image that includes that treated at this Within the scope of byte-threshold.
Optionally, the picture quality of first image is reduced, comprising:
Reduce the clarity of first image.
In the embodiment of the present disclosure, terminal carries out diminution processing to image, obtains the first image, the first image detected Byte volume, if the byte volume of the first image be greater than byte-threshold, terminal according to the Mass adjust- ment of the first image join Number reduces the picture quality of the first image, so that the byte volume for reducing the image that picture quality obtains meets byte-threshold.This The byte body for reducing image is manually operated without user when the byte volume for the image that user uploads is greater than byte-threshold for sample Product reduces byte volume to image automatically by terminal, and it is convenient to operate, and the efficiency for uploading image can be improved.
The present embodiment will be introduced image processing method in conjunction with specific embodiment.This method can be by terminal It realizes, which can be the terminal for being equipped with the application program of displaying target picture.Terminal includes at least video card and CPU (Central Processing Unit, central processing unit).Image processing method flow chart as shown in Figure 2, to reduce ratio Smaller, the byte volume for the image that diminution is handled is smaller, magnification ratio is smaller, the byte body for the image that enhanced processing obtains Product is smaller, Mass adjust- ment parameter is smaller, and the byte volume for reducing the image that picture quality is handled is smaller, for, to image Processing method is illustrated, and the process flow of this method may include following step:
In step 201, the diminution ratio for determining image carries out diminution processing to image according to the ratio of reducing, and obtains the One image.
Wherein, diminution ratio is used to indicate image down to the first width of satisfaction and the first height.
In a kind of feasible embodiment, when image is uploaded to browsing client by user, terminal is read by file Module reads the content of selected image, and the form of picture material can be text, binary system also or base64 is encoded.? On browsing client, image can be chosen by least two modes, and one is file choosing is opened in traditional form list Frame is selected to select image, another kind is to set page elements to " can drag and drop ", user by image be dragged to the web page element into And determine file.Various accidents are likely to occur during image reading, such as user selects the type of image illegal, it should Module can quote mistake, issue the user with prompt information, and user is prompted to re-start valid operation.Get the content of image Afterwards, the Image memory object of the authentic representative picture material is constructed.One kind that Image is supported as all browsers Built-in objects type constructs object instance in a manner of printenv.After Image completes the load of image, then it can obtain Take the original width and original height of image.
Browsing client detects the byte volume of the image.If the byte volume of the image is less than preset word Save threshold value, illustrate the image byte volume be it is legal, subsequent processing can be normally carried out, such as store the image, display The image etc..If the byte volume of the image be greater than byte-threshold, illustrate the image byte volume be it is illegal, need To the byte volume for reducing the image, until the byte volume of the image is equal to preset byte threshold value.
When determining that the byte volume of image of user's upload is greater than byte-threshold, terminal determines the diminution ratio of image, It is handled according to the diminution that the ratio of reducing carries out equal proportion to image, can guarantee that the image after reducing (can be described as the first figure in this way Picture) will not be distorted the case where being distorted, meet basic demand of the practical business to image scaling.
Optionally it is determined that scaled down respective handling can be such that the original width and original height according to image, Determine original the ratio of width to height of image;If original the ratio of width to height is greater than first the ratio of width to height, by the ratio of original height and the first height Value, is determined as the diminution ratio of image, and first the ratio of width to height is the ratio of the first width and the first height;If original the ratio of width to height is small It is determined as the diminution ratio of image then by the ratio of original width and the first width in or equal to first the ratio of width to height.
In a kind of feasible embodiment, as shown in the process of Fig. 3, the original width and original height of image are first determined Degree, determines the original width of image and the ratio of original height, as original the ratio of width to height of image.
The ratio for determining the first width and the first height can be described as first the ratio of width to height.Usually, the first width and first Height can be preset minimum widith and minimum constructive height, for limiting the lower size limit of the image after reducing, so that after reducing Image be unlikely to small and can not see clearly to user.
The original the ratio of width to height determined is compared with preset first the ratio of width to height, if original the ratio of width to height is greater than first The ratio of width to height, as shown in figure 4, in this case, diminution ratio can be calculated according to original height and the first height.Optionally A kind of mode is the ratio of calculating original height and the first height, which is determined as to the diminution ratio of image, so that according to The width and height for the first image that the diminution ratio obtains are not less than the first height, that is, meet the first width and first high Degree.
If original the ratio of width to height is less than or equal to first the ratio of width to height, as shown in figure 5, in this case, it can be according to original Diminution ratio is calculated in width and the first width.A kind of optional mode is the ratio for calculating original width and the first width, The ratio is determined as to the diminution ratio of image, so that the width of the first image obtained according to the diminution ratio and height are not Less than the first width, that is, meet the first width and the first height.
In step 202, the byte volume of the first image is detected.
In a kind of feasible embodiment, through the above steps 201 obtain the first image after, terminal detects the first figure automatically The byte volume of picture, and the byte volume of the first image is compared with preset byte-threshold, determine that the size of the two is closed System.
In step 203, when the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment of the first image is determined Parameter.
Wherein, Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting byte-threshold.
In a kind of feasible embodiment, if the byte volume of the first image is greater than byte-threshold, illustrate to contract image Its byte volume is still greater than byte-threshold after the minimum dimension as low as allowed, and such case can not be by way of minification Reduce the byte volume of image, needs to reduce by way of reducing picture quality the byte volume of image.Therefore, terminal The Mass adjust- ment parameter of the first image is determined, so that reducing the byte of the image obtained after picture quality according to Mass adjust- ment parameter Volume can satisfy byte-threshold.
It optionally, can be according to byte-threshold, Mass adjust- ment parameter in order to relatively rapid determine Mass adjust- ment parameter The byte volume of maximum value and minimum value, corresponding first image of Mass adjust- ment parameter determined every time repeatedly determines first The Mass adjust- ment parameter of image, until the byte volume of corresponding first image of the Mass adjust- ment parameter determined is equal to byte threshold Value.
In a kind of feasible embodiment, when determining Mass adjust- ment parameter, available preset Mass adjust- ment parameter Maximum value and minimum value, Mass adjust- ment parameter is repeatedly selected in maxima and minima, every time select Mass adjust- ment parameter When, detection reduce to the first image the byte body of the image obtained after picture quality processing according to the Mass adjust- ment parameter Product, which is compared with byte-threshold.If the byte volume is not equal to byte-threshold, quality is reselected Adjusting parameter, and detect and the first image is carried out according to the Mass adjust- ment parameter to reduce the image obtained after picture quality processing Byte volume repeats the process of above-mentioned selection Mass adjust- ment parameter, until true if the byte volume is not equal to byte-threshold The byte volume of corresponding first image of the Mass adjust- ment parameter made is equal to byte-threshold, then the Mass adjust- ment parameter is most The Mass adjust- ment parameter of optimization.
Optionally it is determined that there are many ways to Mass adjust- ment parameter, one of feasible method is to pass through optimization Algorithm determines.When using approximation optimization algorithm, algorithm signature can be first defined:
Wherein, return value is optimum solution, and max and min are respectively the maximum value and minimum value of Mass adjust- ment parameter; Func is map procedures function, in the embodiments of the present disclosure, the func function representation byte body of Mass adjust- ment parameter and image Long-pending mapping relations are a kind of algorithms of byte volume that image is calculated by Mass adjust- ment parameter;HighThrehold is indicated The upper limit of the mapping result of func function indicates the byte body for reducing the image obtained after picture quality in the embodiments of the present disclosure Long-pending preset threshold;Precision indicates the permission precision of the mapping result of func function, indicates drop in the embodiments of the present disclosure The allowable error of the byte volume of the image obtained after low image quality.
Func function is iterated, partial code can be shown in following codes:
It is alternatively possible to by regarding as reducing the relationship of the byte volume of the Mass adjust- ment parameter and image of picture quality For mapping function.Due to Mass adjust- ment parameter and the mapping function of the byte volume of image according to input picture it is different without Together, therefore unique and accurate mapping function can not be determined.But the numerical value of Mass adjust- ment parameter is bigger, reduces the journey of picture quality Degree is lower, bigger according to the byte volume of the image after Mass adjust- ment parameter processing, then the byte of Mass adjust- ment parameter and image Volume is the relationship of monotonic increase, as shown in Figure 6.According to the pass of Mass adjust- ment parameter and the monotonic increase of the byte volume of image System more quickly determines Mass adjust- ment parameter, as shown, corresponding processing may include steps of 2031-2035:
Step 2031, the mean value of the maxima and minima of Mass adjust- ment parameter is determined.
Step 2032, the first image is carried out according to mean value reducing picture quality processing.
Step 2033, when the byte volume of treated image is greater than byte-threshold, Mass adjust- ment is updated according to mean value The maximum value of parameter goes to the processing for executing step 2031.
When the byte volume of treated image is greater than byte-threshold, according to the relationship of monotonic increase, aimed quality tune Whole parameter is less than current Mass adjust- ment parameter and therefore sets Mass adjust- ment parameter most for current Mass adjust- ment parameter Big value, reselects Mass adjust- ment parameter.
Step 2034, when the byte volume of treated image is less than byte-threshold, Mass adjust- ment is updated according to mean value The minimum value of parameter goes to the processing for executing step 2031.
When the byte volume of treated image is less than byte-threshold, according to the relationship of monotonic increase, aimed quality tune Whole parameter is greater than current Mass adjust- ment parameter and therefore sets Mass adjust- ment parameter most for current Mass adjust- ment parameter Small value reselects Mass adjust- ment parameter.
Step 2035, when the byte volume of treated image is equal to byte-threshold, mean value is determined as Mass adjust- ment Parameter.
When the byte volume of treated image is equal to byte-threshold, meet the condition for terminating iteration, then by step 2031 mean values being calculated are determined as Mass adjust- ment parameter, terminate iterative processing, export Mass adjust- ment parameter.
It should be noted that stating step 2031-2035 in use carries out the timing really of Mass adjust- ment parameter, it is possible to by In certain problems, so that no matter iteration how many times are all unable to satisfy the end iterated conditional in step 2035, in order to guarantee logic Safety, avoid falling into endless loop, fusing mechanism can be added, for example, in step 2032 increase the number of iterations detection, this time The difference of the mean value of the mean value of iterative process and last iterative process or permissible delay and etc., according to the need of practical application It asks and can choose corresponding fusing mechanism, the disclosure does not limit this.
It should be noted that the Mass adjust- ment parameter determined according to above-mentioned steps 2031-2035, is to be based on approaching byte The conceivable Mass adjust- ment parameter of think of for retaining image information under the premise of threshold limit as possible is the Mass adjust- ment ginseng optimized Number, other than making to determine Mass adjust- ment parameter in this way, can also determine Mass adjust- ment parameter, this public affairs otherwise It opens and does not limit this.
It should be noted that byte-threshold can be byte-threshold range in the embodiment of the present disclosure;Then treated image Byte volume be greater than byte-threshold, the byte volume for the image that can be that treated is greater than the maximum value of byte-threshold range; The byte volume of treated image is less than byte-threshold, can be less than byte-threshold model for the byte volume of treated image The minimum value enclosed;The byte volume of treated image is equal to byte-threshold, can exist for the byte volume of treated image Within the scope of byte-threshold.
In a kind of feasible embodiment, either diminution ratio, magnification ratio or Mass adjust- ment parameter (can be referred to as For image optimization index), the byte volume to the image obtained after image procossing must be almost it is discrete, it is this it is discrete not Byte number is discrete as integer, but between integer not plus 1 is continuous, as shown in Figure 7.As an example it is assumed that currently setting Having set diminution ratio is 0.5, and Mass adjust- ment parameter is 0.92, and the byte volume of the image of output is 10000byte, then almost Not possibly through the adjustment of Mass adjust- ment parameter and the adjustment of size, so that the byte volume of treated image becomes 9999byte or 10001byte.That is, Mass adjust- ment parameter or diminution ratio are set as horizontal axis, by the byte volume of image It is set as always helping, then in coordinate system as shown in the figure, for continuous X axis coordinate, the codomain for being mapped to Y-axis is discontinuous.
That is, being adjusted by Mass adjust- ment parameter or diminution ratio to image, the byte body of obtained image Product possibly can not be exactly equal to threshold values.In order to solve this problem, an allowable error can be set, this allowable error takes Value target is can to eliminate the discontinuity of Y-axis codomain, as shown in figure 8, i.e. allowable error will cannot be less than hanging down for discontinuity point Vertical throw.Rule of thumb, the value of allowable error is greater than 1kb.
After allowable error is arranged, the byte-threshold in the embodiment of the present disclosure is properly termed as byte-threshold range, the byte threshold The upper limit value for being worth range is byte-threshold, and lower limit value is the difference of byte-threshold and allowable error.In this way, by the byte of image When volume and byte-threshold compare, the byte volume of image be greater than byte-threshold range maximum value be image byte body Product is greater than byte-threshold, and it is the byte volume of image less than word that the byte volume of image, which is less than the minimum value of byte-threshold range, Threshold value is saved, the byte volume of image is that the byte volume of image is equal to byte-threshold within the scope of byte-threshold.
Certainly, this is also a kind of feasible pattern that the embodiment of the present disclosure proposes, the embodiment of the present disclosure does not limit this.
In step 204, according to Mass adjust- ment parameter, the picture quality of the first image is reduced.
In a kind of feasible embodiment, after determining Mass adjust- ment parameter through the above steps, according to Mass adjust- ment parameter The picture quality of the first image is reduced, so that the byte volume for reducing the image after picture quality meets byte-threshold.
Optionally, there are many kinds of the modes for reducing the byte volume of image above by picture quality is reduced, wherein can It is capable it is a kind of reduce the byte volume of image by reducing the clarity of the first image, be also possible to other modes, such as drop The color saturation etc. of low image, the disclosure does not limit this.
In step 205, when the byte volume of the first image is less than byte-threshold, the amplification ratio of the first image is determined Example.
Wherein, magnification ratio meets byte-threshold for the first image to be amplified to.
In a kind of feasible embodiment, if 202 detecting that the byte volume of the first image is less than through the above steps Byte-threshold, illustrate it is too big according to the degree for reducing scale smaller, cause the byte volume of the first image obtained after reducing compared with It is small, from the point of view of retaining information content, the first image can be subjected to amplification appropriate, so that amplified image includes more Information content, and still meet byte-threshold.
Optionally, in order to relatively rapid determine magnification ratio, can according to byte-threshold, magnification ratio maximum value and The byte volume of minimum value and corresponding first image of the magnification ratio determined every time repeatedly determines the amplification of the first image Ratio, until the byte volume of corresponding first image of the magnification ratio determined is equal to byte-threshold.
In a kind of feasible embodiment, when determining magnification ratio, the maximum value of available preset magnification ratio And minimum value, magnification ratio is repeatedly selected in maxima and minima, when selecting magnification ratio every time, is detected according to the amplification Ratio amplifies the byte volume of the image obtained after processing to the first image, which is compared with byte-threshold Compared with.If the byte volume is not equal to byte-threshold, magnification ratio is reselected, and detect according to the magnification ratio to first Image amplifies the byte volume of the image obtained after processing, if the byte volume is not equal to byte-threshold, repeats The process for stating selection magnification ratio, until the byte volume of corresponding first image of the magnification ratio determined is equal to byte threshold Value, then the magnification ratio is the magnification ratio optimized.
It is alternatively possible to according to the relationship of the monotonic increase of the byte volume of magnification ratio and image, more quickly really Determine magnification ratio, as shown in figure 9, corresponding processing may include steps of 2051-2055:
Step 2051, the mean value of the maxima and minima of magnification ratio is determined.
Step 2052, processing is amplified to the first image according to mean value.
Step 2053, when the byte volume of treated image is greater than byte-threshold, magnification ratio is updated according to mean value Maximum value, go to execute step 2051 processing.
When the byte volume of treated image is greater than byte-threshold, according to the relationship of monotonic increase, target amplification ratio Example is less than current magnification ratio and therefore sets current magnification ratio to the maximum value of magnification ratio, reselects amplification Ratio.
Step 2054, when the byte volume of treated image is less than byte-threshold, magnification ratio is updated according to mean value Minimum value, go to execute step 2051 processing.
When the byte volume of treated image is less than byte-threshold, according to the relationship of monotonic increase, target amplification ratio Example is greater than current magnification ratio and therefore sets current magnification ratio to the minimum value of magnification ratio, reselects amplification Ratio.
Step 2055, when the byte volume of treated image is equal to byte-threshold, mean value is determined as magnification ratio.
When the byte volume of treated image is equal to byte-threshold, meet the condition for terminating iteration, then by step 2051 mean values being calculated are determined as magnification ratio, terminate iterative processing, export magnification ratio.
It should be noted that stating step 2031-2035 in use carries out the timing really of Mass adjust- ment parameter, it is possible to by In certain problems, so that no matter iteration how many times are all unable to satisfy the end iterated conditional in step 2035, in order to guarantee logic Safety, avoid falling into endless loop, fusing mechanism can be added, for example, in step 2032 increase the number of iterations detection, this time The difference of the mean value of the mean value of iterative process and last iterative process or permissible delay and etc., according to the need of practical application It asks and can choose corresponding fusing mechanism, the disclosure does not limit this.
In step 206, according to magnification ratio, processing is amplified to the first image.
In a kind of feasible embodiment, the first image is amplified according to magnification ratio, terminal detection is amplified After the byte volume of first image meets byte-threshold, so that it may subsequent processing, such as storage image, display image are carried out, this This will not be repeated here for open embodiment.
In the embodiment of the present disclosure, terminal carries out diminution processing to image, obtains the first image, the first image detected Byte volume, if the byte volume of the first image be greater than byte-threshold, terminal according to the Mass adjust- ment of the first image join Number reduces the picture quality of the first image, so that the byte volume for reducing the image that picture quality obtains meets byte-threshold.This The byte body for reducing image is manually operated without user when the byte volume for the image that user uploads is greater than byte-threshold for sample Product reduces byte volume to image automatically by terminal, and it is convenient to operate, and the efficiency for uploading image can be improved.
Figure 10 is a kind of image processing apparatus block diagram shown according to an exemplary embodiment.Referring to Fig.1 0, the device packet Include reducing unit 1010, detection unit 1020, determination unit 1030 and reduction unit 1040.
Reducing unit 1010, according to the diminution ratio, contracts to described image for determining the diminution ratio of image Small processing obtains the first image;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and first Highly;
Detection unit 1020, for detecting the byte volume of the first image;
Determination unit 1030 determines the first image when the byte volume of the first image is greater than byte-threshold Mass adjust- ment parameter, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to described in satisfaction Byte-threshold;
Unit 1040 is reduced, for reducing the picture quality of the first image according to the Mass adjust- ment parameter.
Optionally, the reducing unit 1010, is used for:
According to the original width and original height of described image, original the ratio of width to height of described image is determined;
If described original the ratio of width to height is greater than first the ratio of width to height, by the ratio of the original height and the first height, really It is set to the diminution ratio of described image, described first the ratio of width to height is the ratio of the first width and the first height;
If described original the ratio of width to height is less than or equal to first the ratio of width to height, by the ratio of the original width and the first width Value, is determined as the diminution ratio of described image.
Optionally, the determination unit 1030, is used for:
According to the byte-threshold, the maximum value of Mass adjust- ment parameter and minimum value, every time the Mass adjust- ment ginseng determined The byte volume of corresponding first image of number, repeatedly determines the Mass adjust- ment parameter of the first image, until the matter determined The byte volume for measuring corresponding first image of adjusting parameter is equal to the byte-threshold.
Optionally, the determination unit 1030, is used for:
Determine the mean value of the maxima and minima of Mass adjust- ment parameter;
The first image is carried out according to the mean value to reduce picture quality processing;
When the byte volume of treated image is greater than the byte-threshold, Mass adjust- ment ginseng is updated according to the mean value Several maximum values goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is less than the byte-threshold, Mass adjust- ment ginseng is updated according to the mean value Several minimum values goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as Mass adjust- ment ginseng Number.
Optionally,
The determination unit 1030 is also used to when the byte volume of the first image is less than the byte-threshold, really Determine the magnification ratio of the first image, the magnification ratio meets byte-threshold for the first image to be amplified to;
Amplifying unit, for amplifying processing to the first image according to the magnification ratio.
Optionally, the determination unit 1030, is used for:
The magnification ratio determined according to the byte-threshold, the maximum value of magnification ratio and minimum value and every time is corresponding The first image byte volume, the magnification ratio of the first image is repeatedly determined, until the magnification ratio determined is corresponding The first image byte volume be equal to the byte-threshold.
Optionally, the determination unit 1030, is used for:
Determine the mean value of the maxima and minima of magnification ratio;
Processing is amplified to the first image according to the mean value;
When the byte volume of treated image is greater than the byte-threshold, magnification ratio is updated according to the mean value Maximum value goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is less than the byte-threshold, magnification ratio is updated according to the mean value Minimum value goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as magnification ratio.
Optionally, the byte-threshold is byte-threshold range;
The byte volume of treated the image is greater than the byte volume of the byte-threshold image that includes that treated Greater than the maximum value of the byte-threshold range;
The byte volume of treated the image is less than the byte volume of the byte-threshold image that includes that treated Less than the minimum value of the byte-threshold range;
The byte volume of treated the image is equal to the byte volume of the byte-threshold image that includes that treated Within the scope of the byte-threshold.
Optionally, the reduction unit 1040, is used for:
Reduce the clarity of the first image.
In the embodiment of the present disclosure, terminal carries out diminution processing to image, obtains the first image, the first image detected Byte volume, if the byte volume of the first image be greater than byte-threshold, terminal according to the Mass adjust- ment of the first image join Number reduces the picture quality of the first image, so that the byte volume for reducing the image that picture quality obtains meets byte-threshold.This The byte body for reducing image is manually operated without user when the byte volume for the image that user uploads is greater than byte-threshold for sample Product reduces byte volume to image automatically by terminal, and it is convenient to operate, and the efficiency for uploading image can be improved.
About the device in above-described embodiment, wherein modules execute the concrete mode of operation in related this method Embodiment in be described in detail, no detailed explanation will be given here.
Figure 11 is a kind of structural block diagram of terminal shown according to an exemplary embodiment.The terminal 1100 can be portable Formula mobile terminal, such as: smart phone, tablet computer.Terminal 1100 be also possible to referred to as user equipment, portable terminal etc. its His title.
In general, terminal 1100 includes: processor 1101 and memory 1102.
Processor 1101 may include one or more processing cores, such as 4 core processors, 11 core processors etc.. Processor 1101 can use DSP (Digital Signal Processing, Digital Signal Processing), FPGA (Field- Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array, may be programmed Logic array) at least one of example, in hardware realize.Processor 1101 also may include primary processor and coprocessor, master Processor is the processor for being handled data in the awake state, also referred to as CPU (Central Processing Unit, central processing unit);Coprocessor is the low power processor for being handled data in the standby state.? In some embodiments, processor 1101 can be integrated with GPU (Graphics Processing Unit, image processor), GPU is used to be responsible for the rendering and drafting of content to be shown needed for display screen.In some embodiments, processor 1101 can also be wrapped AI (Artificial Intelligence, artificial intelligence) processor is included, the AI processor is for handling related machine learning Calculating operation.
Memory 1102 may include one or more computer readable storage mediums, which can To be tangible and non-transient.Memory 1102 may also include high-speed random access memory and nonvolatile memory, Such as one or more disk storage equipments, flash memory device.In some embodiments, non-transient in memory 1102 Computer readable storage medium for storing at least one instruction, at least one instruction for performed by processor 1101 with The image processing method provided in the disclosure is provided.
In some embodiments, terminal 1100 is also optional includes: peripheral device interface 1103 and at least one periphery are set It is standby.Specifically, peripheral equipment includes: radio circuit 1104, touch display screen 1105, camera 1106, voicefrequency circuit 1107, determines At least one of hyte part 1108 and power supply 1109.
Peripheral device interface 1103 can be used for I/O (Input/Output, input/output) is relevant outside at least one Peripheral equipment is connected to processor 1101 and memory 1102.In some embodiments, processor 1101, memory 1102 and periphery Equipment interface 1103 is integrated on same chip or circuit board;In some other embodiments, processor 1101, memory 1102 and peripheral device interface 1103 in any one or two can be realized on individual chip or circuit board, this implementation Example is not limited this.
Radio circuit 1104 is for receiving and emitting RF (Radio Frequency, radio frequency) signal, also referred to as electromagnetic signal. Radio circuit 1104 is communicated by electromagnetic signal with communication network and other communication equipments.Radio circuit 1104 is by telecommunications Number being converted to electromagnetic signal is sent, alternatively, the electromagnetic signal received is converted to electric signal.Optionally, radio circuit 1104 include: antenna system, RF transceiver, one or more amplifiers, tuner, oscillator, digital signal processor, volume solution Code chipset, user identity module card etc..Radio circuit 1104 can by least one wireless communication protocol come with it is other Terminal is communicated.The wireless communication protocol includes but is not limited to: WWW, Metropolitan Area Network (MAN), Intranet, each third generation mobile communication network (2G, 3G, 4G and 5G), WLAN and/or WiFi (Wireless Fidelity, Wireless Fidelity) network.In some implementations In example, radio circuit 1104 can also include that NFC (Near Field Communication, wireless near field communication) is related Circuit, the disclosure are not limited this.
Touch display screen 1105 is for showing UI (User Interface, user interface).The UI may include figure, text Sheet, icon, video and its their any combination.Touch display screen 1105 also has acquisition on the surface of touch display screen 1105 Or the ability of the touch signal of surface.The touch signal can be used as control signal and be input at processor 1101 Reason.Touch display screen 1105 is for providing virtual push button and/or dummy keyboard, also referred to as soft button and/or soft keyboard.In some realities It applies in example, touch display screen 1105 can be one, and the front panel of terminal 1100 is arranged;In further embodiments, it touches aobvious Display screen 1105 can be at least two, be separately positioned on the different surfaces of terminal 1100 or in foldover design;In still other implementation In example, touch display screen 1105 can be flexible display screen, be arranged on the curved surface of terminal 1100 or on fold plane.Very Extremely, touch display screen 1105 can also be arranged to non-rectangle irregular figure, namely abnormity screen.Touch display screen 1105 can be with Using LCD (Liquid Crystal Display, liquid crystal display), OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) etc. materials preparation.
CCD camera assembly 1106 is for acquiring image or video.Optionally, CCD camera assembly 1106 includes front camera And rear camera.In general, front camera is for realizing video calling or self-timer, rear camera is for realizing photo or view The shooting of frequency.In some embodiments, rear camera at least two are that main camera, depth of field camera, wide-angle are taken the photograph respectively As any one in head, to realize that main camera and the fusion of depth of field camera realize background blurring function, main camera and wide Pan-shot and VR (Virtual Reality, virtual reality) shooting function are realized in camera fusion in angle.In some embodiments In, CCD camera assembly 1106 can also include flash lamp.Flash lamp can be monochromatic warm flash lamp, be also possible to double-colored temperature flash of light Lamp.Double-colored temperature flash lamp refers to the combination of warm light flash lamp and cold light flash lamp, can be used for the light compensation under different-colour.
Voicefrequency circuit 1107 is used to provide the audio interface between user and terminal 1100.Voicefrequency circuit 1107 may include Microphone and loudspeaker.Microphone is used to acquire the sound wave of user and environment, and converts sound waves into electric signal and be input to processing Device 1101 is handled, or is input to radio circuit 1104 to realize voice communication.For stereo acquisition or the mesh of noise reduction , microphone can be separately positioned on the different parts of terminal 1100 to be multiple.Microphone can also be array microphone or complete To acquisition type microphone.Loudspeaker is then used to that sound wave will to be converted to from the electric signal of processor 1101 or radio circuit 1104. Loudspeaker can be traditional wafer speaker, be also possible to piezoelectric ceramic loudspeaker.When loudspeaker is piezoelectric ceramic loudspeaker When, the audible sound wave of the mankind can be not only converted electrical signals to, the sound that the mankind do not hear can also be converted electrical signals to Wave is to carry out the purposes such as ranging.In some embodiments, voicefrequency circuit 1107 can also include earphone jack.
Positioning component 1108 is used for the current geographic position of positioning terminal 1100, to realize navigation or LBS (Location Based Service, location based service).Positioning component 1108 can be the GPS (Global based on the U.S. Positioning System, global positioning system), China dipper system or Russia Galileo system positioning group Part.
Power supply 1109 is used to be powered for the various components in terminal 1100.Power supply 1109 can be alternating current, direct current Electricity, disposable battery or rechargeable battery.When power supply 1109 includes rechargeable battery, which can be line charge Battery or wireless charging battery.Wired charging battery is the battery to be charged by Wireline, and wireless charging battery is to pass through The battery of wireless coil charging.The rechargeable battery can be also used for supporting fast charge technology.
In some embodiments, terminal 1100 further includes having one or more sensors 1110.One or more sensing Device 1110 includes but is not limited to: acceleration transducer 1111, gyro sensor 1112, pressure sensor 1113, fingerprint sensing Device 1114, optical sensor 1115 and proximity sensor 1116.
Acceleration transducer 1111 can detecte the acceleration in three reference axis of the coordinate system established with terminal 1100 Size.For example, acceleration transducer 1111 can be used for detecting component of the acceleration of gravity in three reference axis.Processor The 1101 acceleration of gravity signals that can be acquired according to acceleration transducer 1111, control touch display screen 1105 with transverse views Or longitudinal view carries out the display of user interface.Acceleration transducer 1111 can be also used for game or the exercise data of user Acquisition.
Gyro sensor 1112 can detecte body direction and the rotational angle of terminal 1100, gyro sensor 1112 Acquisition user can be cooperateed with to act the 3D of terminal 1100 with acceleration transducer 1111.Processor 1101 is according to gyro sensors The data that device 1112 acquires, following function may be implemented: action induction (for example changing UI according to the tilt operation of user) is clapped Image stabilization, game control and inertial navigation when taking the photograph.
The lower layer of side frame and/or touch display screen 1105 in terminal 1100 can be set in pressure sensor 1113.When When the side frame of terminal 1100 is arranged in pressure sensor 1113, user can detecte to the gripping signal of terminal 1100, according to The gripping signal carries out right-hand man's identification or prompt operation.When the lower layer of touch display screen 1105 is arranged in pressure sensor 1113 When, it can be according to user to the pressure operation of touch display screen 1105, the operability control on the interface UI is controlled in realization System.Operability control includes at least one of button control, scroll bar control, icon control, menu control.
Fingerprint sensor 1114 is used to acquire the fingerprint of user, according to the identity of collected fingerprint recognition user.? When the identity for identifying user is trusted identity, the user is authorized to execute relevant sensitive operation, the sensitivity by processor 1101 Operation includes solving lock screen, checking encryption information, downloading software, payment and change setting etc..Fingerprint sensor 1114 can be by The front, the back side or side of terminal 1100 are set.When being provided with physical button or manufacturer Logo in terminal 1100, fingerprint sensing Device 1114 can be integrated with physical button or manufacturer Logo.
Optical sensor 1115 is for acquiring ambient light intensity.In one embodiment, processor 1101 can be according to light The ambient light intensity that sensor 1115 acquires is learned, the display brightness of touch display screen 1105 is controlled.Specifically, work as ambient light intensity When higher, the display brightness of touch display screen 1105 is turned up;When ambient light intensity is lower, the aobvious of touch display screen 1105 is turned down Show brightness.In another embodiment, the ambient light intensity that processor 1101 can also be acquired according to optical sensor 1115, is moved The acquisition parameters of state adjustment CCD camera assembly 1106.
Proximity sensor 1116, also referred to as range sensor are generally arranged at the front of terminal 1100.Proximity sensor 1116 For acquiring the distance between the front of user Yu terminal 1100.In one embodiment, when proximity sensor 1116 detects When the distance between the front of user and terminal 1100 gradually becomes smaller, touch display screen 1105 is controlled from bright screen by processor 1101 State is switched to breath screen state;When proximity sensor 1116 detects that the distance between user and the front of terminal 1100 gradually become When big, touch display screen 1105 is controlled by processor 1101 and is switched to bright screen state from breath screen state.
It, can be with it will be understood by those skilled in the art that the restriction of the not structure paired terminal 1100 of structure shown in Figure 11 Including than illustrating more or fewer components, perhaps combining certain components or being arranged using different components.
In the exemplary embodiment, a kind of non-transitorycomputer readable storage medium including instruction, example are additionally provided It such as include the memory 1104 of instruction, above-metioned instruction can be executed by the processor 1120 of device 1100 to complete above-mentioned image procossing Method, this method comprises: determining that the diminution ratio of image carries out diminution processing to described image, obtain according to the diminution ratio To the first image;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;Detection The byte volume of the first image;When the byte volume of the first image is greater than byte-threshold, first figure is determined The Mass adjust- ment parameter of picture, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting State byte-threshold;According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.For example, the non-transitory Computer readable storage medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk and optical data storage Equipment etc..
In the exemplary embodiment, a kind of application program, including one or more instruction are additionally provided, this one or more Instruction can be executed by the processor 1120 of electronic equipment 1100, to complete above-mentioned image processing method, this method comprises: determining The diminution ratio of image carries out diminution processing to described image, obtains the first image according to the diminution ratio;The diminution Ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;Detect the byte body of the first image Product;When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment parameter of the first image is determined, it is described Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte-threshold;According to the matter Adjusting parameter is measured, the picture quality of the first image is reduced.Optionally, above-metioned instruction can also be by electronic equipment 1100 Device 1120 is managed to execute to complete other steps involved in the above exemplary embodiments.
Those skilled in the art will readily occur to its of the disclosure after considering specification and practicing disclosure disclosed herein Its embodiment.This application is intended to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or Person's adaptive change follows the general principles of this disclosure and including the undocumented common knowledge in the art of the disclosure Or conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by following Claim is pointed out.
It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present disclosure is only limited by the accompanying claims.

Claims (10)

1. a kind of image processing method characterized by comprising
The diminution ratio for determining image carries out diminution processing to described image, obtains the first image according to the diminution ratio; The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detect the byte volume of the first image;
When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment parameter of the first image, institute are determined It states Mass adjust- ment parameter and is used to indicate and adjust the byte volume of the first image to meeting the byte-threshold;
According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.
2. image processing method according to claim 1, which is characterized in that the diminution ratio of the determining image, comprising:
According to the original width and original height of described image, original the ratio of width to height of described image is determined;
The ratio of the original height and the first height is determined as if described original the ratio of width to height is greater than first the ratio of width to height The diminution ratio of described image, described first the ratio of width to height are the ratio of the first width and the first height;
If described original the ratio of width to height is less than or equal to first the ratio of width to height, by the ratio of the original width and the first width, It is determined as the diminution ratio of described image.
3. image processing method according to claim 1, which is characterized in that the quality tune of the determining the first image Whole parameter, comprising:
According to the byte-threshold, the maximum value of Mass adjust- ment parameter and minimum value, every time the Mass adjust- ment parameter pair determined The byte volume for the first image answered repeatedly determines the Mass adjust- ment parameter of the first image, until the quality tune determined The byte volume of corresponding first image of whole parameter is equal to the byte-threshold.
4. image processing method according to claim 3, which is characterized in that described according to the byte-threshold, quality tune The byte volume of the maximum value and minimum value of whole parameter, corresponding first image of the Mass adjust- ment parameter determined every time, repeatedly The Mass adjust- ment parameter for determining the first image, until the byte body of corresponding first image of the Mass adjust- ment parameter determined Product is equal to the byte-threshold, comprising:
Determine the mean value of the maxima and minima of Mass adjust- ment parameter;
The first image is carried out according to the mean value to reduce picture quality processing;
When the byte volume of treated image is greater than the byte-threshold, Mass adjust- ment parameter is updated according to the mean value Maximum value goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is less than the byte-threshold, Mass adjust- ment parameter is updated according to the mean value Minimum value goes to the processing for executing the mean value of maxima and minima of the determining Mass adjust- ment parameter;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as Mass adjust- ment parameter.
5. image processing method according to claim 1, which is characterized in that the method also includes:
When the byte volume of the first image is less than the byte-threshold, the magnification ratio of the first image, institute are determined It states magnification ratio and meets byte-threshold for the first image to be amplified to;
According to the magnification ratio, processing is amplified to the first image.
6. image processing method according to claim 5, which is characterized in that the amplification ratio of the determining the first image Example, comprising:
The magnification ratio corresponding determined according to the byte-threshold, the maximum value of magnification ratio and minimum value and every time The byte volume of one image repeatedly determines the magnification ratio of the first image, until the magnification ratio determined corresponding the The byte volume of one image is equal to the byte-threshold.
7. image processing method according to claim 6, which is characterized in that described according to the byte-threshold, amplification ratio The maximum value of example and the byte volume of minimum value and corresponding first image of the magnification ratio determined every time, repeatedly determine institute The magnification ratio for stating the first image, until the byte volume of corresponding first image of the magnification ratio determined is equal to the byte Threshold value, comprising:
Determine the mean value of the maxima and minima of magnification ratio;
Processing is amplified to the first image according to the mean value;
When the byte volume of treated image is greater than the byte-threshold, the maximum of magnification ratio is updated according to the mean value Value, goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is less than the byte-threshold, the minimum of magnification ratio is updated according to the mean value Value, goes to the processing for executing the mean value of maxima and minima of the determining magnification ratio;
When the byte volume of treated image is equal to the byte-threshold, the mean value is determined as magnification ratio.
8. a kind of image processing apparatus characterized by comprising
Reducing unit, according to the diminution ratio, carries out diminution processing to described image for determining the diminution ratio of image, Obtain the first image;The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detection unit, for detecting the byte volume of the first image;
Determination unit determines the quality tune of the first image when the byte volume of the first image is greater than byte-threshold Whole parameter, the Mass adjust- ment parameter, which is used to indicate, adjusts the byte volume of the first image to meeting the byte threshold Value;
Unit is reduced, for reducing the picture quality of the first image according to the Mass adjust- ment parameter.
9. a kind of terminal characterized by comprising
Processor;
Memory for storage processor executable instruction;
Wherein, the processor is configured to:
The diminution ratio for determining image carries out diminution processing to described image, obtains the first image according to the diminution ratio; The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detect the byte volume of the first image;
When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment parameter of the first image, institute are determined It states Mass adjust- ment parameter and is used to indicate and adjust the byte volume of the first image to meeting the byte-threshold;
According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.
10. a kind of non-transitorycomputer readable storage medium, which is characterized in that when the instruction in the storage medium is by servicing When the processor of device executes, enable the server to execute a kind of image processing method, which comprises
The diminution ratio for determining image carries out diminution processing to described image, obtains the first image according to the diminution ratio; The diminution ratio, which is used to indicate, to be contracted to described image to meet the first width and the first height;
Detect the byte volume of the first image;
When the byte volume of the first image is greater than byte-threshold, the Mass adjust- ment parameter of the first image, institute are determined It states Mass adjust- ment parameter and is used to indicate and adjust the byte volume of the first image to meeting the byte-threshold;
According to the Mass adjust- ment parameter, the picture quality of the first image is reduced.
CN201910202918.7A 2019-03-18 2019-03-18 Image processing method, device, terminal and storage medium Active CN109872294B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910202918.7A CN109872294B (en) 2019-03-18 2019-03-18 Image processing method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910202918.7A CN109872294B (en) 2019-03-18 2019-03-18 Image processing method, device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109872294A true CN109872294A (en) 2019-06-11
CN109872294B CN109872294B (en) 2022-05-24

Family

ID=66920740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910202918.7A Active CN109872294B (en) 2019-03-18 2019-03-18 Image processing method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109872294B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111209862A (en) * 2020-01-03 2020-05-29 深圳力维智联技术有限公司 Face image clustering method, device and medium
CN114302146A (en) * 2021-12-30 2022-04-08 阿里巴巴新加坡控股有限公司 Image processing method, image processing device, electronic equipment and computer storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103493469A (en) * 2009-09-10 2014-01-01 摩托罗拉移动公司 Method and apparatus for loading a photo
CN104463780A (en) * 2014-12-23 2015-03-25 深圳供电局有限公司 Method and device for clipping picture on mobile terminal
CN105989069A (en) * 2015-02-10 2016-10-05 中国移动通信集团云南有限公司 Webpage adaptive adjustment method and device
CN106326477A (en) * 2016-08-31 2017-01-11 北京云图微动科技有限公司 Image downloading method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103493469A (en) * 2009-09-10 2014-01-01 摩托罗拉移动公司 Method and apparatus for loading a photo
CN104463780A (en) * 2014-12-23 2015-03-25 深圳供电局有限公司 Method and device for clipping picture on mobile terminal
CN105989069A (en) * 2015-02-10 2016-10-05 中国移动通信集团云南有限公司 Webpage adaptive adjustment method and device
CN106326477A (en) * 2016-08-31 2017-01-11 北京云图微动科技有限公司 Image downloading method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111209862A (en) * 2020-01-03 2020-05-29 深圳力维智联技术有限公司 Face image clustering method, device and medium
CN111209862B (en) * 2020-01-03 2023-09-29 深圳力维智联技术有限公司 Clustering method, device and medium for face images
CN114302146A (en) * 2021-12-30 2022-04-08 阿里巴巴新加坡控股有限公司 Image processing method, image processing device, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN109872294B (en) 2022-05-24

Similar Documents

Publication Publication Date Title
CN112907725B (en) Image generation, training of image processing model and image processing method and device
CN109522863B (en) Ear key point detection method and device and storage medium
CN108063981A (en) The method and apparatus that the attribute of direct broadcasting room is set
CN109558837A (en) Face critical point detection method, apparatus and storage medium
WO2022134632A1 (en) Work processing method and apparatus
CN109859102A (en) Special display effect method, apparatus, terminal and storage medium
CN109886208A (en) Method, apparatus, computer equipment and the storage medium of object detection
CN109583370A (en) Human face structure grid model method for building up, device, electronic equipment and storage medium
CN109522146A (en) The method, apparatus and storage medium of abnormality test are carried out to client
CN110991457A (en) Two-dimensional code processing method and device, electronic equipment and storage medium
CN109978996A (en) Generate method, apparatus, terminal and the storage medium of expression threedimensional model
KR20210075673A (en) Electronic device for measuring a skin state of a user and method of operating the same
EP4040332A1 (en) Method and apparatus for upgrading an intelligent model and non-transitory computer readable storage medium
CN110070143A (en) Obtain method, apparatus, equipment and the storage medium of training data
CN108734662A (en) The method and apparatus for showing icon
CN112135191A (en) Video editing method, device, terminal and storage medium
CN110535890A (en) The method and apparatus that file uploads
CN109872294A (en) Image processing method, device, terminal and storage medium
CN111857793B (en) Training method, device, equipment and storage medium of network model
CN109961802B (en) Sound quality comparison method, device, electronic equipment and storage medium
CN110991445A (en) Method, device, equipment and medium for identifying vertically arranged characters
CN112989198B (en) Push content determination method, device, equipment and computer-readable storage medium
CN108664300A (en) A kind of application interface display methods under picture-in-picture mode and device
CN108829582A (en) The method and apparatus of program compatibility
CN110147796A (en) Image matching method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant