CN108322755B - Picture compression processing method and system - Google Patents

Picture compression processing method and system Download PDF

Info

Publication number
CN108322755B
CN108322755B CN201810023095.7A CN201810023095A CN108322755B CN 108322755 B CN108322755 B CN 108322755B CN 201810023095 A CN201810023095 A CN 201810023095A CN 108322755 B CN108322755 B CN 108322755B
Authority
CN
China
Prior art keywords
picture
size
original picture
original
compression
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.)
Active
Application number
CN201810023095.7A
Other languages
Chinese (zh)
Other versions
CN108322755A (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.)
Seashell Housing Beijing Technology Co Ltd
Original Assignee
Lianjia Beijing 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 Lianjia Beijing Technology Co Ltd filed Critical Lianjia Beijing Technology Co Ltd
Priority to CN201810023095.7A priority Critical patent/CN108322755B/en
Publication of CN108322755A publication Critical patent/CN108322755A/en
Application granted granted Critical
Publication of CN108322755B publication Critical patent/CN108322755B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • H04N19/467Embedding additional information in the video signal during the compression process characterised by the embedded information being invisible, e.g. watermarking

Abstract

The invention provides a picture compression processing method and a system, wherein the method comprises the following steps: performing screenshot processing on the whole original picture, wherein the size of the screenshot processed picture is the same as that of the original picture; acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture, and setting a compression quality threshold value; and compressing the picture after screenshot processing by adopting a JPG compression mode, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value. The invention carries out screenshot processing on the original picture, compresses the picture after screenshot, and sets the picture compression quality threshold value, so that the compressed picture can ensure the compression quality on the basis of ensuring the compression ratio, thereby ensuring the picture compression ratio and the picture compression quality.

Description

Picture compression processing method and system
Technical Field
The present invention relates to the field of picture compression technologies, and in particular, to a picture compression processing method and system.
Background
At the IOS mobile end, the storage format of the photo taken is JPG, and essentially all digital photos are saved in this format. JPG itself is a compression process, and the files stored in JPG format are 1/10-1/20 for other types of graphics files. In general, jpg files are only tens of KB, and the color number can reach 24 bits, so the jpg format is widely used on Internet to save network transmission resources.
Because the picture obtained by photographing contains a large amount of information such as color values, light, shadow and the like, a single JPG format picture taken by the iPhone mobile phone can reach about 6Mb-12Mb, and even if the picture is compressed again, the picture is maintained at the size of about 1.5Mb or more.
For the developer, 1.5Mb is still too large, and if uploading to the server, the pressure on the broadband is too great, and the storage and traffic consumption is too great. The ideal size should be maintained around 100 Kb.
When a developer compresses a picture obtained by photographing, highlight pixels in the picture and invisible pixels in the visual range of naked eyes are mainly compressed. It cannot be compressed too many times because the distortion rate is kept low, which results in a low compression rate. To achieve the ideal size of about 100Kb, the picture needs to be compressed for multiple times, pixels in the picture are removed for multiple times, one pixel only occupies 4 bits, and to achieve the ideal value, the compression quality threshold needs to be continuously modified to remove more pixels, so that after multiple times of compression, the picture has high distortion, is blurred, loses readability, and some of the pixels even can modify the size of the original picture.
Disclosure of Invention
The present invention provides a picture compression processing method and system for overcoming the above problems or at least partially solving the above problems, which can overcome the problems of low compression rate and high distortion degree of the existing picture compression.
According to an aspect of the present invention, there is provided a picture compression processing method, including:
performing screenshot processing on the whole original picture, wherein the size of the screenshot processed picture is the same as that of the original picture;
acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture, and setting a compression quality threshold value;
and compressing the picture after screenshot processing, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value.
The invention has the beneficial effects that: the method comprises the steps of carrying out screenshot processing on an original picture, compressing the picture after the screenshot processing, and setting a picture compression quality threshold value, so that the compressed picture can ensure the compression quality on the basis of ensuring the compression ratio, thereby ensuring the picture compression ratio and the picture compression quality.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, step S1 is preceded by:
acquiring the size of an original picture and the size of the original picture; and judging whether the size of the original picture is within an ideal range value of the size of the picture corresponding to the size of the original picture, if so, directly reserving the original picture without compressing the original picture, and if not, performing screenshot processing on the original picture.
Further, before the screenshot processing is performed on the original picture, the method further includes:
and acquiring exif information of the original picture, determining the rotation angle of the original picture according to the direction value, and adjusting the view angle of the original picture to the normal view angle of the default photographing system.
Further, the picture size ideal range value may be determined according to a width-to-height pixel ratio of the picture and a width-to-height pixel value of the picture, and the method further includes:
and constructing a corresponding relation table of the wide-high pixel ratio of the picture, the wide-high pixel value of the picture and the ideal range value of the size of the picture.
Further, the obtaining of the picture size ideal range value corresponding to the original picture size according to the original picture size specifically includes:
and calculating the width-height pixel ratio of the original picture, searching in the corresponding relation table according to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture, and finding out the picture size ideal range value corresponding to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture.
Further, the step of compressing the screenshot to keep the size of the compressed picture within the ideal range value and satisfy the compression quality threshold specifically includes:
compressing the picture after screenshot processing by adopting a JPG compression mode, and acquiring the compression quality of the picture when the size of the picture after screenshot is compressed to the upper limit value of the size of the picture; judging whether the compression quality of the picture is less than or equal to a set compression quality threshold value, if so, stopping compression, and returning to the compressed picture;
and if the compression quality of the picture is greater than the set compression quality threshold, continuing to compress the picture until the size of the finally compressed picture is equal to the lower limit value of the size of the picture or the compression quality of the finally compressed picture is equal to the set compression quality threshold.
Further, the method also comprises the following steps:
and adding the watermark character string to the finally compressed picture according to a pre-designed watermark adding path.
Further, the watermark path is a diagonal path or an arc track path;
when the watermark adding path is an oblique line path, determining the rotation direction and the rotation angle of the oblique line path, and adding the watermark character string into the compressed picture according to the rotation direction and the rotation angle of the oblique line path;
and when the watermark adding path is an arc track, setting the radius of the arc track, determining the rotation direction of the arc track and the initial angle of the watermark character string starting to rotate, and adding the watermark character string into the compressed picture in a rotating manner according to the radius of the arc track and the rotation direction from the initial angle.
According to another aspect of the present invention, there is provided a picture compression processing system including:
the capture module is used for carrying out capture processing on the whole original picture, wherein the size of the picture after capture processing is the same as that of the original picture;
the acquisition module is used for acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture and setting a compression quality threshold value;
and the compression module is used for compressing the picture after screenshot processing, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value.
According to still another aspect of the present invention, there is provided a non-transitory computer-readable storage medium characterized by storing computer instructions that cause the computer to execute a picture compression processing method.
Drawings
FIG. 1 is a flowchart of a method for compressing a picture according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating adding a watermark to a compressed picture according to an embodiment of the present invention;
FIG. 3 is a block diagram of a connection of a picture compression processing system according to another embodiment of the present invention;
FIG. 4 is a block diagram of the overall connection of a picture compression processing system according to another embodiment of the present invention;
fig. 5 is a connection block diagram of an electronic device according to still another embodiment of the invention.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Referring to fig. 1, a picture compression processing method according to an embodiment of the present invention is provided, which can ensure the compression quality of a picture on the basis of improving the picture compression rate, so that the compressed picture is clear. The method comprises the following steps: performing screenshot processing on the whole original picture, wherein the size of the screenshot processed picture is the same as that of the original picture; acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture, and setting a compression quality threshold value; and compressing the picture after screenshot processing, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value.
Because the JPG compression mode is adopted to directly compress the original picture, the size of the compressed picture is still large, and the compression ratio is low. To increase the compression rate, it is necessary to not compress the original picture, because the original picture data is too large to be directly compressed. In this embodiment, the original image is subjected to screenshot, and the intercepted area is just the size area of the original image, so that the size of the acquired screenshot image can be directly reduced to less than 2Mb within the range recognizable by naked eyes, and the compression rate is directly increased to over 78%.
And after the original picture is subjected to screenshot processing, wherein the size of the original picture is stored in the process of screenshot processing of the original picture, and the size of the screenshot picture is recovered, for example, the size of the screenshot picture is smaller than that of the original picture, and the size of the screenshot picture is adjusted to be the same as that of the original picture.
Obtaining a picture obtained after screenshot processing is performed on an original picture, obtaining an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture, and setting a compression quality threshold, wherein the compression quality threshold means that the compression quality of the finally compressed picture cannot be smaller than the set compression quality threshold, otherwise, the distortion of the compressed picture is too high, and the picture is very unclear.
And then, compressing the screenshot picture by adopting a JPG compression mode, so that the size of the compressed picture is kept within an ideal range value and meets a compression quality threshold value, namely the compression quality of the finally compressed picture cannot be smaller than the set compression quality threshold value.
The embodiment performs screenshot processing on the original picture, greatly reduces the size of the original picture, compresses the picture after screenshot, and sets the picture compression quality threshold value, so that the compressed picture can ensure the compression quality on the basis of ensuring the compression ratio, thereby ensuring the picture compression ratio and the picture compression quality.
In an embodiment of the present invention, the step S1 is preceded by: acquiring the size of an original picture and the size of the original picture; and judging whether the size of the original picture is within an ideal range value of the size of the picture corresponding to the size of the original picture, if so, directly returning the original picture without compressing the original picture, and if not, performing screenshot processing on the original picture.
Because the screenshot processing is performed on the original picture and the picture after the screenshot is compressed to make the size of the compressed picture within the ideal range value, before the screenshot processing is performed on the original picture, it is necessary to first determine whether the size of the original picture is within the corresponding ideal range value. The specific process is that firstly, the size of an original picture and the size of the original picture are obtained, and whether the size of the original picture is within an ideal range value of the size of the picture corresponding to the size of the original picture is judged. The size of the picture is expressed by a pixel value, the pixel values of the picture sizes are different, and the ideal value ranges of the corresponding sizes (expressed by the size of the memory occupied by the picture) of the picture are also different. If the size of the original picture is within the corresponding ideal range value, the original picture does not need to be compressed, and the original picture is directly returned; if the size of the original picture is not within the corresponding ideal range value, it is indicated that the size of the original picture is too large, for example, because the picture obtained by photographing contains a large amount of light, shadow and line lamp information, which occupies a large amount of memory, the influence of these factors needs to be eliminated, and the visual effect of the user is not affected, the original picture needs to be subjected to screenshot, the size of the screenshot picture is much smaller than that of the original picture, and the size of the screenshot picture is basically below 2 Mb.
In another embodiment of the present invention, before the screenshot of the original picture, the method further includes: and acquiring exif information of the original picture, determining the rotation angle of the original picture according to the direction value, and adjusting the view angle of the original picture to the normal view angle of the default photographing system.
Before screenshot is performed on an original picture, the photographing system has a normal default view angle during photographing, for example, the photographing system of an iPhone mobile phone of the IOS system has a normal default horizontal screen photographing view angle. For an original picture obtained by photographing, a photographing angle needs to be corrected to a default normal photographing angle of a photographing system, and a specific correction process is to modify a rotation angle of the picture according to a photographing direction value by reading exif information in the picture, wherein the exif information comprises data such as a photographing direction value, photographing equipment, photographing time, IOS (input optical system) sensitivity, GPS (global position system) geographic position and the like, so that the angle of view of the picture is consistent with the default normal photographing angle of the photographing system. Here, the reason why the angle of view of the picture needs to be adjusted is that the server processes the picture according to the default normal angle of view of the photographing system.
In an embodiment of the present invention, the determining the ideal range value of the picture size according to the wide-high pixel ratio of the picture and the wide-high pixel value of the picture includes: and constructing a corresponding relation table of the ratio of the width and height pixels of the picture, the width and height pixel value of the picture and the ideal range value of the picture size.
The foregoing embodiment describes that the ideal range value corresponding to the picture size is obtained according to the original picture size, and therefore, the corresponding relationship between the picture size and the ideal range value of the picture size needs to be established in advance. The picture size is expressed by specific pixel values, the ideal range value of the picture size is related to the wide-high pixel value of the picture and the wide-high pixel ratio of the picture, and when the corresponding relation is established, a corresponding relation table among the wide-high pixel ratio of the picture, the wide-high pixel value of the picture and the ideal range value of the picture size is established.
In another embodiment of the present invention, the obtaining of the ideal range value of the picture size corresponding to the original picture size according to the original picture size specifically includes: calculating the width-height pixel ratio of the original picture; and searching in the corresponding relation table according to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture, and finding out an ideal range value of the picture size corresponding to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture.
The specific process of obtaining the ideal range value of the picture size corresponding to the original picture size according to the original picture size includes obtaining a wide-high pixel value of the original picture and calculating a wide-high pixel ratio of the original picture, and then searching in the correspondence table according to the wide-high pixel value of the original picture and the wide-high pixel ratio of the original picture to find the ideal range value of the picture size corresponding to the wide-high pixel ratio of the original picture and the wide-high pixel value of the original picture.
In an embodiment of the present invention, the ideal range value of the picture size includes a picture size upper limit value and a picture size lower limit value, and compressing the screenshot by using a JPG compression method so that the size of the compressed picture is kept within the ideal range value and the compression quality threshold is satisfied specifically includes: compressing the screenshot by adopting a JPG compression mode, compressing the picture size of the screenshot to the upper limit value of the picture size, and acquiring the compression quality of the picture at the moment; judging whether the compression quality of the picture is less than or equal to a set compression quality threshold value, if so, stopping compression, and returning to the compressed picture; and if the compression quality of the picture is greater than the set compression quality threshold, continuing to compress the picture until the size of the finally compressed picture is equal to the lower limit value of the size of the picture or the compression quality of the finally compressed picture is equal to the set compression quality threshold.
And in the process of compressing the screenshot picture, compressing the picture by adopting a JPG compression mode, wherein the ideal range value of the picture size comprises a picture size upper limit value and a picture size lower limit value. In the process of compressing the picture, the compression ratio of the picture and the compression quality of the picture need to be summed up and considered, the compression ratio of the picture is too low, the size after the picture compression is still large, the occupied memory is large, meanwhile, the picture is excessively compressed, the distortion degree of the picture is high, and the picture after the picture compression is blurred. Therefore, these two factors are balanced in the process of compressing pictures. Specifically, in the process of compressing the screenshot picture by adopting a JPG compression mode, the screenshot picture is compressed to the picture size upper limit value, and the picture compression quality at the moment is obtained. In the process of compressing the screenshot picture to the picture size upper limit value, the compression quality may be 1, and the compression quality is decreased by a fixed step length, for example, the compression quality is gradually decreased by a step length of 0.06 to compress the screenshot picture. And comparing the picture compression quality at the moment with a set compression quality threshold, and determining whether the picture needs to be compressed continuously according to a comparison result.
And if the image compression quality at the moment is less than or equal to the set compression quality threshold, stopping compressing the image, wherein the image at the moment is not compressed too low in compression quality. If the picture compression quality at the moment is larger than the set compression quality threshold, the picture can be continuously compressed, and in the process of continuous compression, when the picture is compressed until the size of the picture reaches the picture size lower limit value or the compression quality of the picture reaches the set compression quality threshold, the picture is stopped being compressed.
In summary, in the process of compressing the screenshot, the compression quality of the compressed picture is ensured to be above the set compression quality threshold as much as possible while the size of the compressed picture is ensured to be within the corresponding ideal range of the size of the picture. The sum of the compression ratio and the compression quality is considered, so that the size of the compressed picture can be ensured to be within a proper size range, the distortion degree of the compressed picture can be ensured to be lower, and the picture can be kept clear and visible.
In one embodiment of the invention, the watermark character string is added to the final compressed picture according to a pre-designed watermark adding path.
In the prior art, the JPG compression mode only realizes compression processing on pictures and cannot realize addition of watermarks in the pictures. The embodiment can realize the function of adding the watermark to the compressed picture. Specifically, a watermark adding path is designed on the compressed picture, and then the watermark character string is added to the compressed picture according to the designed watermark adding path.
Wherein, the watermark path is a diagonal path or a circular arc track path. When the watermark adding path is a diagonal path, determining the direction of the diagonal path, and adding the watermark character string to the compressed picture according to the direction of the diagonal path; and when the watermark adding path is an arc track, setting the radius of the arc track, determining the rotation direction of the arc track and the initial angle of the watermark character string starting to rotate, and adding the watermark character string into the compressed picture in a rotating manner according to the radius of the arc track and the rotation direction from the initial angle.
Referring to fig. 2, for example, if the path of adding the watermark character string to the compressed picture is a circular arc track path, first designing a circular arc track radius, for example, designing a circular arc track radius of 100mm, and specifying a rotation direction of the track, which is clockwise or counterclockwise, and determining a starting angle at which the watermark character string starts to rotate, for example, starting from-2/pi.
In the specific implementation process, the watermark character string is decomposed into individual characters, the individual characters are stored in an array according to the sequence, the angle occupied by each character is calculated and stored in the array, and then the total angle occupied by all the characters is calculated. Traversing all characters in the array, calculating the angle that each character should rotate from the start angle, e.g., if one character occupies an angle of 3 °, the first character rotates 3 ° from the start angle, and the second character rotates 6 ° from the start angle. In the rotating process, the coordinate of the center point of each character is calculated relative to the coordinate system of the current equipment, the center point of the coordinate system of the current equipment is moved to the center point of each character, then each character is rotated by a corresponding angle from the initial angle, the same method is adopted for each character, and after the group traversal is finished, the watermark on the circular arc track path is obtained.
When the watermark adding path is a diagonal path, the method is relatively simpler than a circular arc track path, and the rotating angle and direction of each character and the distance between every two characters are determined, so that the character string watermark can be added.
Referring to fig. 3, a picture compression processing system according to an embodiment of the present invention is provided, which includes a truncating module 21, an obtaining module 22, and a compressing module 23.
The capture module 21 is configured to perform capture processing on an original picture, where a size of the captured picture is the same as a size of the original picture.
The obtaining module 22 is configured to obtain an ideal range value of the picture size corresponding to the original picture size according to the original picture size, and set a compression quality threshold.
And the compression module 23 is configured to compress the picture obtained by screenshot processing by the capture module 21 in a JPG compression manner, so that the size of the compressed picture is kept within an ideal range value and meets a compression quality threshold.
Referring to fig. 4, a picture compression processing system according to an embodiment of the present invention is provided, which includes an intercepting module 21, an obtaining module 22, a compressing module 23, a determining module 24, an adjusting module 25, a constructing module 26, a searching module 27, and an adding module 28.
And the capture module 21 is configured to perform capture processing on the original picture, where a size of the captured picture is the same as that of the original picture.
The obtaining module 22 is configured to obtain an ideal range value of the picture size corresponding to the original picture size according to the original picture size, and set a compression quality threshold.
And the compression module 23 is configured to compress the picture obtained by screenshot processing by the capture module 21 in a JPG compression manner, so that the size of the compressed picture is kept within an ideal range value and meets a compression quality threshold.
The obtaining module 22 is further configured to obtain an original picture size and an original picture size.
And the judging module 24 is configured to judge whether the size of the original picture is within an ideal range of the size of the picture corresponding to the size of the original picture, if so, the original picture is directly returned to the original picture without being compressed, and if not, the capturing module 21 is invoked to perform screenshot processing on the original picture.
And an adjusting module 25, configured to obtain exif information of the original picture before the capture module 21 performs screenshot processing on the original picture, determine a rotation angle of the original picture according to a direction value of the exif information, and adjust a viewing angle of the original picture to a normal viewing angle of the default photographing of the photographing system.
The ideal range value of the picture size may be determined according to the wide-high pixel ratio of the picture and the wide-high pixel value of the picture, and correspondingly, the building module 26 is configured to build a correspondence table between the wide-high pixel ratio of the picture, the wide-high pixel value of the picture and the ideal range value of the picture size.
The searching module 27 is configured to calculate a width-to-height pixel ratio of the original picture, search in the correspondence table according to the width-to-height pixel ratio of the original picture and the width-to-height pixel value of the original picture, find an ideal range value of the picture size corresponding to the width-to-height pixel ratio of the original picture and the width-to-height pixel value of the original picture, and provide the obtaining module 22 to obtain the ideal range value of the picture size corresponding to the original picture size.
The ideal range value of the picture size includes a picture size upper limit value and a picture size lower limit value, and correspondingly, the obtaining module 22 is further configured to obtain the compression quality of the picture at the moment when the picture size of the screenshot is compressed to the picture size upper limit value by adopting a JPG compression mode; correspondingly, the judging module 24 is further configured to judge whether the compression quality of the picture at this time is less than or equal to a set compression quality threshold, if so, stop the compression, and return to the compressed picture; if the compression quality of the picture is greater than the set compression quality threshold value at this time, the compression module 23 is called to continue to compress the picture until the size of the picture after final compression is equal to the picture size lower limit value or the compression quality of the picture after final compression is equal to the set compression quality threshold value.
And an adding module 28, configured to add a watermark character string to the finally compressed picture according to a pre-designed watermark adding path.
Wherein, the watermark path is a diagonal path or a circular arc track path; correspondingly, the adding module 28 is specifically configured to determine a rotation direction and a rotation angle of the diagonal path when the watermark adding path is the diagonal path, and add the watermark character string to the compressed picture according to the rotation direction and the rotation angle of the diagonal path; and the method is further specifically used for setting the radius of the circular arc track when the watermark adding path is the circular arc track, determining the rotation direction of the circular arc track and the initial angle of the watermark character string starting to rotate, and adding the watermark character string to the compressed picture in a rotating manner according to the radius of the circular arc track and the rotation direction from the initial angle.
Referring to fig. 5, an electronic device according to an embodiment of the present invention includes: a processor (processor)501, a memory (memory)502, and a bus 503; the processor 501 and the memory 502 are in communication with each other via the bus 503.
The processor 501 is configured to call program instructions in the memory 502 to perform the methods provided by the above-mentioned method embodiments, for example, including: performing screenshot processing on the whole original picture, wherein the size of the screenshot processed picture is the same as that of the original picture; acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture, and setting a compression quality threshold value; and compressing the picture after screenshot processing, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value.
The invention discloses a computer program product, which comprises a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer can execute the picture compression processing method provided by the corresponding embodiment, for example, the method comprises: performing screenshot processing on the whole original picture, wherein the size of the screenshot processed picture is the same as that of the original picture; acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture, and setting a compression quality threshold value; and compressing the picture after screenshot processing, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value.
The picture compression processing method and the picture compression processing system provided by the invention have the advantages that the original picture is subjected to screenshot processing, the size of the original picture is greatly reduced, the picture subjected to screenshot is compressed, the size of the compressed picture can be kept within an ideal range value only by a small number of times of compression processing, a picture compression quality threshold value is set, the compression quality of the compressed picture can be guaranteed on the basis of guaranteeing the compression ratio, the balance between the compression ratio and the distortion degree is achieved, and the compressed picture achieves a better effect.
Finally, the method of the present application is only a preferred embodiment and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A picture compression processing method is characterized by comprising the following steps:
performing screenshot processing on the whole original picture, wherein the size of the picture after the screenshot processing is adjusted to be the same as that of the original picture, or the intercepted area is just the area of the original picture size;
acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture, and setting a compression quality threshold value;
compressing the picture after screenshot processing, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value;
the method further comprises the following steps:
constructing a corresponding relation table of the ratio of the width and height pixels of the picture, the width and height pixel value of the picture and the ideal range value of the size of the picture;
the obtaining of the picture size ideal range value corresponding to the original picture size according to the original picture size specifically includes:
and calculating the width-height pixel ratio of the original picture, searching in the corresponding relation table according to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture, and finding out the picture size ideal range value corresponding to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture.
2. The picture compression processing method according to claim 1, wherein the screenshot processing is performed on the whole original picture, wherein the size of the screenshot-processed picture is adjusted to be the same as the size of the original picture, or the truncated area is just the area of the original picture size, and before the step of performing the screenshot processing on the whole original picture, the method further comprises:
acquiring the size of an original picture and the size of the original picture;
and judging whether the size of the original picture is within an ideal range value of the size of the picture corresponding to the size of the original picture, if so, directly reserving the original picture without compressing the original picture, and if not, performing screenshot processing on the original picture.
3. The picture compression processing method according to claim 2, wherein before the screenshot processing on the original picture, the method further comprises:
and acquiring exif information of the original picture, determining the rotation angle of the original picture according to the direction value, and adjusting the view angle of the original picture to the normal view angle of the default photographing system.
4. The method of claim 1, wherein the ideal range value of the picture size includes an upper limit value of the picture size and a lower limit value of the picture size, and the compressing the screenshot to keep the size of the compressed picture within the ideal range value and satisfy the compression quality threshold specifically includes:
compressing the picture after screenshot processing by adopting a JPG compression mode, and acquiring the compression quality of the picture when the size of the picture after screenshot is compressed to the upper limit value of the size of the picture; judging whether the compression quality of the picture is less than or equal to a set compression quality threshold value, if so, stopping compression, and returning to the compressed picture;
and if the compression quality of the picture is greater than the set compression quality threshold, continuing to compress the picture until the size of the finally compressed picture is equal to the lower limit value of the size of the picture or the compression quality of the finally compressed picture is equal to the set compression quality threshold.
5. The picture compression processing method according to any one of claims 1 to 4, further comprising:
and adding the watermark character string to the finally compressed picture according to a pre-designed watermark adding path.
6. The picture compression processing method according to claim 5, wherein the watermarking path is a diagonal path or a circular arc track path;
when the watermark adding path is an oblique line path, determining the rotation direction and the rotation angle of the oblique line path, and adding the watermark character string into the compressed picture according to the rotation direction and the rotation angle of the oblique line path;
and when the watermark adding path is an arc track, setting the radius of the arc track, determining the rotation direction of the arc track and the initial angle of the watermark character string starting to rotate, and adding the watermark character string into the compressed picture in a rotating manner according to the radius of the arc track and the rotation direction from the initial angle.
7. A picture compression processing system, comprising:
the intercepting module is used for carrying out screenshot processing on the whole original picture, wherein the size of the picture after screenshot processing is adjusted to be the same as that of the original picture, or the intercepted area is just the area of the original picture size;
the acquisition module is used for acquiring an ideal range value of the size of the picture corresponding to the size of the original picture according to the size of the original picture and setting a compression quality threshold value;
the compression module is used for compressing the picture after screenshot processing, so that the size of the compressed picture is kept within the ideal range value and meets the compression quality threshold value;
the system further comprises:
the construction module is used for constructing a corresponding relation table of the wide-high pixel ratio of the picture, the wide-high pixel value of the picture and the ideal range value of the size of the picture;
a lookup module to: and calculating the width-height pixel ratio of the original picture, searching in the corresponding relation table according to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture, finding out a picture size ideal range value corresponding to the width-height pixel ratio of the original picture and the width-height pixel value of the original picture, and allowing the acquisition module to acquire the picture size ideal range value corresponding to the size of the original picture.
8. A non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the method of any one of claims 1-6.
CN201810023095.7A 2018-01-10 2018-01-10 Picture compression processing method and system Active CN108322755B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810023095.7A CN108322755B (en) 2018-01-10 2018-01-10 Picture compression processing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810023095.7A CN108322755B (en) 2018-01-10 2018-01-10 Picture compression processing method and system

Publications (2)

Publication Number Publication Date
CN108322755A CN108322755A (en) 2018-07-24
CN108322755B true CN108322755B (en) 2021-07-09

Family

ID=62893292

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810023095.7A Active CN108322755B (en) 2018-01-10 2018-01-10 Picture compression processing method and system

Country Status (1)

Country Link
CN (1) CN108322755B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111311699A (en) * 2020-01-17 2020-06-19 北京达佳互联信息技术有限公司 Picture compression method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104902282A (en) * 2015-06-04 2015-09-09 深圳市明日空间信息技术有限公司 Processing method and device for embedding watermark image into video frame
CN105491414A (en) * 2015-11-19 2016-04-13 深圳市时尚德源文化传播有限公司 Synchronous display method and device of images
CN105979265A (en) * 2016-05-05 2016-09-28 贵州白山云科技有限公司 Image compression method and apparatus

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8579442B2 (en) * 2009-05-27 2013-11-12 Transpacific Image, Llc Advertisement content selection and presentation
US9465572B2 (en) * 2011-11-09 2016-10-11 Microsoft Technology Licensing, Llc Dynamic server-side image sizing for fidelity improvements
US20180007340A1 (en) * 2016-06-29 2018-01-04 Barbara Carey Stachowski Method and system for motion controlled mobile viewing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104902282A (en) * 2015-06-04 2015-09-09 深圳市明日空间信息技术有限公司 Processing method and device for embedding watermark image into video frame
CN105491414A (en) * 2015-11-19 2016-04-13 深圳市时尚德源文化传播有限公司 Synchronous display method and device of images
CN105979265A (en) * 2016-05-05 2016-09-28 贵州白山云科技有限公司 Image compression method and apparatus

Also Published As

Publication number Publication date
CN108322755A (en) 2018-07-24

Similar Documents

Publication Publication Date Title
US7860343B2 (en) Constructing image panorama using frame selection
CN108124194B (en) Video live broadcast method and device and electronic equipment
WO2017113917A1 (en) Imaging method, imaging apparatus, and terminal
CN107704798B (en) Image blurring method and device, computer readable storage medium and computer device
CN113992850B (en) ISP-based image processing method and device, storage medium and image pickup apparatus
US8995784B2 (en) Structure descriptors for image processing
CN111598777A (en) Sky cloud image processing method, computer device and readable storage medium
WO2018045789A1 (en) Method and device for adjusting grayscale values of image
CN108322755B (en) Picture compression processing method and system
CN110913118B (en) Video processing method, device and storage medium
US9076207B1 (en) Image processing method, system and electronic device
CN114913067A (en) Rendering method and device for dynamic resolution, electronic equipment and readable storage medium
US20040190023A1 (en) Image processing method, apparatus and program
CN110049247B (en) Image optimization method and device, electronic equipment and readable storage medium
CN108235024B (en) Method and device for compressing image
CN110796689A (en) Video processing method, electronic equipment and storage medium
CN107481199B (en) Image defogging method and device, storage medium and mobile terminal
WO2022062641A1 (en) Calling interface display method and apparatus, electronic device, and storage medium
CN112084155B (en) Picture processing method, device, equipment, terminal and readable storage medium
CN115049572A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN111866514B (en) Method and device for compressing video and decompressing video
CN108933945B (en) GIF picture compression method, device and storage medium
CN108200433A (en) A kind of compression of images and decompression method
CN114449150A (en) Photographing method, photographing device, terminal and computer-readable storage medium
CN113411505B (en) Photographing control method and device and storage medium

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
CP01 Change in the name or title of a patent holder

Address after: 100085 Floor 101 102-1, No. 35 Building, No. 2 Hospital, Xierqi West Road, Haidian District, Beijing

Patentee after: Seashell Housing (Beijing) Technology Co.,Ltd.

Address before: 100085 Floor 101 102-1, No. 35 Building, No. 2 Hospital, Xierqi West Road, Haidian District, Beijing

Patentee before: LIANJIA(BEIJING) TECHNOLOGY Co.,Ltd.

CP01 Change in the name or title of a patent holder