CN111009017B - Picture compression method and device, storage medium and computer equipment - Google Patents
Picture compression method and device, storage medium and computer equipment Download PDFInfo
- Publication number
- CN111009017B CN111009017B CN201910996311.0A CN201910996311A CN111009017B CN 111009017 B CN111009017 B CN 111009017B CN 201910996311 A CN201910996311 A CN 201910996311A CN 111009017 B CN111009017 B CN 111009017B
- Authority
- CN
- China
- Prior art keywords
- picture
- compressed
- information
- compression ratio
- compressing
- 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
Links
- 230000006835 compression Effects 0.000 title claims abstract description 131
- 238000007906 compression Methods 0.000 title claims abstract description 131
- 238000000034 method Methods 0.000 title claims abstract description 47
- 238000006243 chemical reaction Methods 0.000 claims description 35
- 238000004590 computer program Methods 0.000 claims description 8
- 230000005540 biological transmission Effects 0.000 abstract description 3
- 230000000694 effects Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T9/00—Image coding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/58—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
- G06F16/5866—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using information manually generated, e.g. tags, keywords, comments, manually generated location and time information
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Library & Information Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The application relates to a picture compression method, a picture compression device, a storage medium and computer equipment, wherein the method comprises the following steps: judging whether the picture to be compressed is a compressible picture or not according to the characteristic information of the picture to be compressed; if the picture to be compressed is a compressible picture, acquiring the picture type of the picture to be compressed; compressing the picture to be compressed according to the picture type of the picture to be compressed; acquiring a target compression ratio corresponding to a picture to be compressed after the picture to be compressed is compressed; and if the target compression ratio is larger than or equal to the preset value, saving the compressed picture to replace the picture before compression. By compressing the picture on the premise of reducing picture distortion, the size of the picture file in the application program is greatly reduced, and the file transmission efficiency of the application program is improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for compressing a picture, a storage medium, and a computer device.
Background
With the development of the internet, application programs are increasingly developed and popularized, and the content of the application programs is enriched due to the application of various pictures. However, due to the fact that a large number of pictures are used, the memory occupied by the application program is too large, time consumption is long in the application upgrading and downloading process, and user experience is affected. In the prior art, when a picture is compressed, the picture may be distorted due to the fact that an incompressible picture is also compressed, or repeated invalid work is caused due to the fact that an incompressible picture is compressed in an invalid manner, and compression efficiency is reduced.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, embodiments of the present application provide a picture compression method, apparatus, storage medium, and computer device.
In a first aspect, an embodiment of the present application provides a method for compressing an image, where the method includes:
judging whether the picture to be compressed is a compressible picture or not according to the characteristic information of the picture to be compressed;
if the picture to be compressed is a compressible picture, acquiring the picture type of the picture to be compressed, wherein the picture type is a disguised picture or a non-disguised picture;
compressing the picture to be compressed according to the picture type of the picture to be compressed;
acquiring a target compression ratio corresponding to a picture to be compressed after the picture to be compressed is compressed;
and if the target compression ratio is larger than or equal to the preset value, saving the compressed picture to replace the picture before compression.
Optionally, determining whether the picture to be compressed is a compressible picture according to the feature information of the picture to be compressed, including:
acquiring characteristic information of a picture to be compressed;
judging whether keywords matched with the shielding keywords in the prestored keyword list exist in the characteristic information;
and if the keyword matched with the shielding keyword in the pre-stored keyword list exists in the characteristic information, judging the picture to be compressed as an incompressible picture.
Optionally, the method further comprises:
if the target compression ratio is smaller than a preset value, extracting keywords from the characteristic information of the picture to be compressed;
and adding the extracted keywords as shielding keywords into the keyword list.
Optionally, the obtaining a picture type of a picture to be compressed includes:
acquiring file header identification information and file suffix information of a picture to be compressed;
if the picture format corresponding to the file header identification information is not consistent with the picture format corresponding to the file suffix information, the picture to be compressed is judged to be a camouflage picture;
and if the picture format corresponding to the file header identification information is consistent with the picture format corresponding to the file suffix information, judging that the picture to be compressed is a non-disguised picture.
Optionally, compressing the picture to be compressed according to the picture type of the picture to be compressed includes:
if the picture to be compressed is a non-disguised picture, compressing the picture to be compressed;
if the picture to be compressed is a camouflage picture, converting the picture to be compressed through a first conversion rule;
wherein the first conversion rule comprises: converting the file suffix information of the picture to be compressed to ensure that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information;
and compressing the converted picture to be compressed.
Optionally, compressing the picture to be compressed according to the picture type of the picture to be compressed includes:
if the picture to be compressed is a non-disguised picture, compressing the picture to be compressed;
if the picture to be compressed is a camouflage picture, detecting whether the picture to be compressed contains transparent color;
if the picture to be compressed contains transparent color, the picture to be compressed is converted through a first conversion rule,
wherein the first conversion rule comprises: converting the file suffix information of the picture to be compressed to ensure that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information,
compressing the converted picture to be compressed;
if the picture to be compressed does not contain transparent color, the picture to be compressed is respectively converted through a first conversion rule and a second conversion rule,
respectively compressing the converted pictures to be compressed,
wherein the first conversion rule comprises: converting the file suffix information of the picture to be compressed to ensure that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information,
the second conversion rule includes: and converting the file header identification information of the picture to be compressed, so that the picture format corresponding to the converted file header identification information is consistent with the picture format corresponding to the file suffix information.
Optionally, the obtaining of the target compression ratio corresponding to the compressed picture includes:
if the picture to be compressed is a non-disguised picture or a disguised picture and contains transparent color, obtaining a compression ratio obtained by compressing the picture to be compressed after being converted by a first conversion rule, and taking the compression ratio obtained after compression as a target compression ratio;
if the picture to be compressed is a camouflage picture and does not contain transparent color, acquiring a first compression ratio obtained by compressing the picture to be compressed after the picture to be compressed is converted by a first conversion rule,
obtaining a second compression ratio obtained by compressing the picture to be compressed after the picture is converted by a second conversion rule,
and comparing the first compression ratio with the second compression ratio to obtain a maximum value, and taking the compression ratio corresponding to the maximum value as a target compression ratio.
Optionally, the method further comprises:
acquiring character information on a picture to be compressed;
judging whether reserved character information matched with the character information exists in a pre-stored character information list or not;
and if the image does not exist, deleting the text information on the image to be compressed.
In a second aspect, an embodiment of the present application further provides a picture compression apparatus, where the apparatus includes:
the judging module is used for judging whether the picture to be compressed is a compressible picture according to the characteristic information of the picture to be compressed;
the image type acquisition module is used for acquiring the image type of the image to be compressed if the image to be compressed is a compressible image, wherein the image type is a disguised image or a non-disguised image;
the compression module is used for compressing the picture to be compressed according to the picture type of the picture to be compressed;
the compression ratio obtaining module is used for obtaining a target compression ratio corresponding to the compressed picture;
an execution module for receiving compression if the target compression ratio is greater than or equal to a preset value, storing the compressed picture to replace the picture before compression,
and if the target compression ratio is smaller than the preset value, refusing to compress and reserving the picture to be compressed before compression.
In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, causes the processor to execute the steps of any one of the foregoing picture compression methods.
In a fourth aspect, the present application further provides a computer device, where the computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to perform the steps of any one of the foregoing image compression methods.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
the image is compressed, so that the size of an image file in an application program is greatly reduced, and the file transmission efficiency of the application program is improved; the keywords of the incompressible picture are stored, so that repeated invalid compression is avoided, and the operation expense is reduced; the picture is further compressed according to whether the picture to be compressed contains transparent color, so that the picture can be effectively compressed, and the picture distortion can be reduced; and deleting invalid character information on the picture to be compressed, and further reducing the size of the picture on the premise of not influencing the picture effect. Compressing pictures is significant to scenes using a large number of pictures, so that application programs are simple, and the work of development and maintenance personnel is reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic structural diagram of a computer device according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a picture compression method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another picture compression method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another picture compression method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of another picture compression method according to an embodiment of the present application;
fig. 6 is a schematic flowchart of another picture compression method according to an embodiment of the present application;
fig. 7 is a schematic flowchart of another picture compression method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a picture compression apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a schematic structural diagram of a computer device according to an embodiment of the present application; the computer device may be a terminal device. Referring to fig. 1, the computer device includes a processor, a nonvolatile storage medium, an internal memory, a network interface, and a display screen connected by a system bus, wherein the nonvolatile storage medium includes an operating system, a computer program, and a picture compression apparatus for implementing a picture compression method. The processor is used to provide computing and control capabilities to support the operation of the entire computer device. The computer program, when processed and executed, causes a processor to implement a picture compression method. The network interface may be an ethernet card or a wireless network card, etc. for communicating with an external device. The display screen may be used to display pictures. The computer device may be a mobile phone, a tablet computer, or a personal digital assistant or a wearable device, etc. It will be understood by those skilled in the art that the schematic structural diagram shown in fig. 1 is a block diagram of only a part of the structure related to the present application, and does not constitute a limitation to the computer device to which the present application is applied, and in particular, the computer device may include more or less components than those shown in the figure, or combine some components, or have a different arrangement of components.
Fig. 2 is a schematic flowchart of a picture compression method according to an embodiment of the present application; referring to fig. 2, the picture compression method includes the steps of:
s100: and judging whether the picture to be compressed is a compressible picture or not according to the characteristic information of the picture to be compressed.
Whether the picture to be compressed is a compressible picture or not can be judged through the characteristic information of the picture, if the picture is the compressible picture, the compression is carried out, and if the picture is the incompressible picture, the compression is abandoned, so that the work of invalid compression is reduced.
S200: and if the picture to be compressed is a compressible picture, acquiring the picture type of the picture to be compressed.
If the picture to be compressed is a compressible picture, the picture type of the picture to be compressed is further identified, otherwise, the compression is directly abandoned, and the invalid work is also reduced. Optionally, the disguised picture is a picture whose picture format corresponding to the file header identification information of the picture is inconsistent with the picture format corresponding to the file suffix information, the non-disguised picture refers to a picture whose picture format corresponding to the file header identification information of the picture is consistent with the picture format corresponding to the file suffix information, and the file suffix information is an extension of the picture.
S300: and compressing the picture to be compressed according to the picture type of the picture to be compressed.
And compressing the picture according to different rules according to whether the picture is a disguised picture or a non-disguised picture.
S400: and acquiring a target compression ratio corresponding to the picture to be compressed after the picture to be compressed is compressed.
And comparing the sizes of the picture files before and after the picture to be compressed is compressed, wherein the compression ratio is the ratio of the difference value between the size of the picture before the compression and the size of the picture after the compression to the size of the picture before the compression.
Of course, the ratio of the size of the compressed picture to the size of the picture before compression can be used to determine whether the compression effect is achieved.
S500: and if the target compression ratio is larger than or equal to the preset value, saving the compressed picture to replace the picture before compression.
If the target compression ratio is not high and cannot reach the preset value, and the compression effect is not good, giving up the compression; and when the target compression ratio reaches a preset value, the compressed picture is reserved to replace the picture before compression. The compression effect is further improved by the compression cost and the cost performance.
Fig. 3 is a schematic flowchart of another picture compression method according to an embodiment of the present application; referring to fig. 3, step S100 includes the steps of:
s110: and acquiring the characteristic information of the picture to be compressed.
The feature information of the picture may be, but is not limited to, a file name of the picture, an extension of the picture, a folder name of a folder in which the picture is located, and the like.
S120: and judging whether the feature information contains keywords matched with the shielding keywords in the pre-stored keyword list.
And extracting keywords from the characteristic information of the picture to be compressed, and matching the extracted keywords with the shielding keywords in the keyword list.
The shielding keywords in the keyword list may be keywords of a picture which is manually shielded in advance by a technician and does not need to be compressed, or keywords of a picture to be compressed with a poor compression effect may be extracted and stored.
S130: and if the keyword matched with the shielding keyword in the pre-stored keyword list exists in the characteristic information, judging the picture to be compressed as an incompressible picture.
If the extracted keywords are matched with the shielding keywords, the picture to be compressed is judged to be an incompressible picture, and compression is directly abandoned, so that invalid work is avoided.
Fig. 4 is a schematic flowchart of another picture compression method according to an embodiment of the present application; referring to fig. 4, the picture compression method further includes the steps of:
s600: and if the target compression ratio is smaller than the preset value, extracting keywords from the characteristic information of the picture to be compressed.
S700: and adding the extracted keywords as shielding keywords into the keyword list.
If the compression effect is not good, the compression is abandoned, the keywords of the picture to be compressed are stored in the keyword list, and in the following compression work, the compressed picture can be directly judged as an incompressible picture, so that the repeated invalid compression is avoided.
Fig. 5 is a schematic flowchart of another picture compression method according to an embodiment of the present application; referring to fig. 5, step S200 includes the steps of:
s210: and acquiring file header identification information and file suffix information of the picture to be compressed.
There are many picture formats for pictures, for example: JPEG, PNG, GIF, BMP, TIFF, etc., cannot determine the real format of a picture according to the file suffix information (e.g., JPG,. PNG,. GIF, etc.) of the picture, and can determine that the real format of the picture is the file header identification information of the picture.
S220: and judging whether the picture format corresponding to the file header identification information is consistent with the picture format corresponding to the file suffix information, if so, executing the step S240, and if not, executing the step S230.
S230: and judging the picture to be compressed as a camouflage picture.
S240: and judging that the picture to be compressed is a non-camouflage picture.
And when the picture format corresponding to the file header identification information is not consistent with the picture format corresponding to the file suffix information, the picture to be compressed is a disguised picture, and the real picture format of the picture is the picture format corresponding to the file header identification information.
Fig. 6 is a schematic flowchart of another picture compression method according to an embodiment of the present application; referring to fig. 6, step S300 includes the steps of:
s310: and if the picture to be compressed is a non-disguised picture, compressing the picture to be compressed.
S320: and if the picture to be compressed is a disguised picture, converting the picture to be compressed by a first conversion rule.
The first conversion rule is: and converting the file suffix information of the picture to be compressed, so that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information.
The first conversion rule is to convert the file suffix information of the picture to be compressed into file suffix information corresponding to the real format, so that the camouflage picture is converted into a non-camouflage picture and then compressed. The picture is not distorted as much as possible.
S330: and compressing the converted picture to be compressed.
Fig. 7 is a schematic flowchart of another picture compression method according to an embodiment of the present application; referring to fig. 7, step S300 includes the steps of:
s310: and if the picture to be compressed is a non-disguised picture, compressing the picture to be compressed.
S320: if the picture to be compressed is a camouflage picture, detecting whether the picture to be compressed contains transparent color, if so, executing step S330, and if not, executing step S350.
S330: and converting the picture to be compressed through a first conversion rule.
S340: and compressing the converted picture to be compressed.
If the disguised picture contains transparent color, the picture to be compressed needs to be converted into a real format, and the real format can contain the transparent color of the picture, so that the picture distortion is avoided.
S350: and respectively converting the picture to be compressed by a first conversion rule and a second conversion rule.
S360: and respectively compressing the converted pictures to be compressed.
The first conversion rule is: and converting the file suffix information of the picture to be compressed, so that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information.
The second conversion rule includes: and converting the file header identification information of the picture to be compressed, so that the picture format corresponding to the converted file header identification information is consistent with the picture format corresponding to the file suffix information.
If the disguised picture does not contain transparent color, the picture to be compressed does not need to be forcibly converted into a real format, and the picture to be compressed is converted respectively through the first conversion rule and the second conversion rule and then is compressed respectively.
If the picture to be compressed is a non-disguised picture or a disguised picture and contains transparent color, obtaining a compression ratio obtained by compressing the picture to be compressed after being converted by a first conversion rule, and taking the compression ratio obtained after compression as a target compression ratio; and when the target compression ratio is more than or equal to the preset compression ratio, keeping the compressed picture, otherwise, giving up the compression.
If the picture to be compressed is a camouflage picture and does not contain transparent color, a first compression ratio obtained by compressing the picture to be compressed after the picture to be compressed is converted through a first conversion rule is obtained.
And obtaining a second compression ratio obtained by compressing the image to be compressed after the image to be compressed is converted by the second conversion rule.
And comparing the first compression ratio with the second compression ratio to obtain a maximum value, taking the compression ratio corresponding to the maximum value as a target compression ratio, when the target compression ratio is more than or equal to a preset compression ratio, keeping the compressed picture, otherwise, giving up the compression.
Optionally, in an embodiment, the picture compression method further includes the following steps:
acquiring character information on a picture to be compressed;
judging whether reserved character information matched with the character information exists in a pre-stored character information list or not;
and if the image does not exist, deleting the text information on the image to be compressed.
Optionally, the method and the device can identify the compressed pictures, or limit the number of times of compression of the pictures, and avoid the influence on the display effect of the pictures caused by repeated compression of the same picture.
Fig. 8 is a schematic structural diagram of a picture compression apparatus according to an embodiment of the present application, and referring to fig. 8, the picture compression apparatus includes:
the judging module 10 is configured to judge whether the picture to be compressed is a compressible picture according to the feature information of the picture to be compressed;
the picture type obtaining module 20 is configured to obtain a picture type of the picture to be compressed if the picture to be compressed is a compressible picture, where the picture type is a disguised picture or a non-disguised picture;
the compression module 30 is configured to compress the picture to be compressed according to the picture type of the picture to be compressed;
a compression ratio obtaining module 40, configured to obtain a target compression ratio corresponding to the compressed picture;
and the execution module 50 is configured to accept compression if the target compression rate is greater than or equal to a preset value, and store the compressed picture to replace the picture before compression.
The image is compressed, so that the size of an image file in an application program is greatly reduced, and the file transmission efficiency of the application program is improved; the keywords of the incompressible picture are stored, so that repeated invalid compression is avoided, and the operation expense is reduced; the picture is further compressed according to whether the picture to be compressed contains transparent color, so that the picture can be effectively compressed, and the picture distortion can be reduced; and deleting invalid character information on the picture to be compressed, and further reducing the size of the picture on the premise of not influencing the picture effect.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. A method of picture compression, the method comprising:
judging whether the picture to be compressed is a compressible picture or not according to the characteristic information of the picture to be compressed;
if the picture to be compressed is a compressible picture, acquiring the picture type of the picture to be compressed, wherein the picture type is a disguised picture or a non-disguised picture;
compressing the picture to be compressed according to the picture type of the picture to be compressed;
acquiring a target compression ratio corresponding to the picture to be compressed after the picture to be compressed is compressed;
if the target compression ratio is larger than or equal to a preset value, saving the compressed picture to replace the picture before compression;
wherein, the obtaining the picture type of the picture to be compressed includes:
acquiring file header identification information and file suffix information of the picture to be compressed;
if the picture format corresponding to the file header identification information is not consistent with the picture format corresponding to the file suffix information, the picture to be compressed is judged to be a camouflage picture;
and if the picture format corresponding to the file header identification information is consistent with the picture format corresponding to the file suffix information, judging that the picture to be compressed is a non-disguised picture.
2. The method according to claim 1, wherein the determining whether the picture to be compressed is a compressible picture according to the feature information of the picture to be compressed comprises:
acquiring the characteristic information of the picture to be compressed;
judging whether keywords matched with shielding keywords in a prestored keyword list exist in the characteristic information;
and if the feature information contains keywords matched with the shielding keywords in the pre-stored keyword list, judging the picture to be compressed as an incompressible picture.
3. The method of claim 2, further comprising:
if the target compression ratio is smaller than the preset value, extracting keywords from the characteristic information of the picture to be compressed;
and adding the extracted keywords as shielding keywords into the keyword list.
4. The method according to claim 1, wherein compressing the picture to be compressed according to the picture type of the picture to be compressed comprises:
if the picture to be compressed is a non-camouflage picture, compressing the picture to be compressed;
if the picture to be compressed is a camouflage picture, converting the picture to be compressed through a first conversion rule;
wherein the first conversion rule comprises: converting the file suffix information of the picture to be compressed to ensure that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information;
and compressing the converted picture to be compressed.
5. The method according to claim 1, wherein compressing the picture to be compressed according to the picture type of the picture to be compressed comprises:
if the picture to be compressed is a non-camouflage picture, compressing the picture to be compressed;
if the picture to be compressed is a camouflage picture, detecting whether the picture to be compressed contains transparent color;
if the picture to be compressed contains transparent color, converting the picture to be compressed through a first conversion rule,
wherein the first conversion rule comprises: converting the file suffix information of the picture to be compressed to ensure that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information,
compressing the converted picture to be compressed;
if the picture to be compressed does not contain transparent color, the picture to be compressed is respectively converted through a first conversion rule and a second conversion rule,
respectively compressing the converted pictures to be compressed,
wherein the first conversion rule comprises: converting the file suffix information of the picture to be compressed to ensure that the picture format corresponding to the converted file suffix information is consistent with the picture format corresponding to the file header identification information,
the second conversion rule includes: and converting the file header identification information of the picture to be compressed, so that the picture format corresponding to the converted file header identification information is consistent with the picture format corresponding to the file suffix information.
6. The method according to claim 5, wherein the obtaining of the target compression ratio corresponding to the compressed picture comprises:
if the picture to be compressed is a non-disguised picture or a disguised picture and contains transparent color, obtaining a compression ratio obtained by compressing the picture to be compressed after being converted by a first conversion rule, and taking the compression ratio obtained after compression as a target compression ratio;
if the picture to be compressed is a camouflage picture and does not contain transparent color, acquiring a first compression ratio obtained by compressing the picture to be compressed after the picture to be compressed is converted by a first conversion rule,
obtaining a second compression rate obtained by compressing the picture to be compressed after the picture is converted by a second conversion rule,
and comparing the first compression ratio with the second compression ratio to obtain a maximum value, and taking the compression ratio corresponding to the maximum value as a target compression ratio.
7. The method of claim 6, further comprising:
acquiring character information on a picture to be compressed;
judging whether reserved character information matched with the character information exists in a pre-stored character information list or not;
and if the image does not exist, deleting the text information on the image to be compressed.
8. An apparatus for compressing pictures, the apparatus comprising:
the judging module is used for judging whether the picture to be compressed is a compressible picture according to the characteristic information of the picture to be compressed;
the image type acquisition module is used for acquiring the image type of the image to be compressed if the image to be compressed is a compressible image, wherein the image type is a disguised image or a non-disguised image;
the compression module is used for compressing the picture to be compressed according to the picture type of the picture to be compressed;
the compression ratio obtaining module is used for obtaining a target compression ratio corresponding to the picture to be compressed after the picture to be compressed is compressed;
the execution module is used for receiving compression if the target compression ratio is more than or equal to a preset value, and storing the compressed picture to replace the picture before compression;
wherein the picture type obtaining module is further configured to:
acquiring file header identification information and file suffix information of the picture to be compressed;
if the picture format corresponding to the file header identification information is not consistent with the picture format corresponding to the file suffix information, the picture to be compressed is judged to be a camouflage picture;
and if the picture format corresponding to the file header identification information is consistent with the picture format corresponding to the file suffix information, judging that the picture to be compressed is a non-disguised picture.
9. A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 7.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor executes the program to perform the steps of the method according to any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910996311.0A CN111009017B (en) | 2019-10-18 | 2019-10-18 | Picture compression method and device, storage medium and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910996311.0A CN111009017B (en) | 2019-10-18 | 2019-10-18 | Picture compression method and device, storage medium and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111009017A CN111009017A (en) | 2020-04-14 |
CN111009017B true CN111009017B (en) | 2021-08-17 |
Family
ID=70111305
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910996311.0A Active CN111009017B (en) | 2019-10-18 | 2019-10-18 | Picture compression method and device, storage medium and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111009017B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116800877A (en) * | 2022-03-17 | 2023-09-22 | 华为技术有限公司 | Picture processing method and related equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007060619A (en) * | 2005-07-27 | 2007-03-08 | Ricoh Co Ltd | Image processing unit, method and program for compressing image, and recording medium |
CN106470037A (en) * | 2015-08-21 | 2017-03-01 | 博雅网络游戏开发(深圳)有限公司 | Intelligent compression method and system |
CN106851291A (en) * | 2011-01-11 | 2017-06-13 | 索尼公司 | Image processing equipment and method |
CN107515704A (en) * | 2017-08-04 | 2017-12-26 | 珠海格力电器股份有限公司 | Method and device for previewing compressed file |
CN108399052A (en) * | 2018-02-07 | 2018-08-14 | 深圳壹账通智能科技有限公司 | Picture compression method, apparatus, computer equipment and storage medium |
CN109376762A (en) * | 2018-09-13 | 2019-02-22 | 西安万像电子科技有限公司 | Image processing method and device |
CN109947722A (en) * | 2019-02-13 | 2019-06-28 | 北京达佳互联信息技术有限公司 | Data compression method, device and computer readable storage medium for application program |
-
2019
- 2019-10-18 CN CN201910996311.0A patent/CN111009017B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007060619A (en) * | 2005-07-27 | 2007-03-08 | Ricoh Co Ltd | Image processing unit, method and program for compressing image, and recording medium |
CN106851291A (en) * | 2011-01-11 | 2017-06-13 | 索尼公司 | Image processing equipment and method |
CN106470037A (en) * | 2015-08-21 | 2017-03-01 | 博雅网络游戏开发(深圳)有限公司 | Intelligent compression method and system |
CN107515704A (en) * | 2017-08-04 | 2017-12-26 | 珠海格力电器股份有限公司 | Method and device for previewing compressed file |
CN108399052A (en) * | 2018-02-07 | 2018-08-14 | 深圳壹账通智能科技有限公司 | Picture compression method, apparatus, computer equipment and storage medium |
CN109376762A (en) * | 2018-09-13 | 2019-02-22 | 西安万像电子科技有限公司 | Image processing method and device |
CN109947722A (en) * | 2019-02-13 | 2019-06-28 | 北京达佳互联信息技术有限公司 | Data compression method, device and computer readable storage medium for application program |
Non-Patent Citations (3)
Title |
---|
Page segmentation and content classification for automatic document image processing;S.K. Yip等;《ISIMP 2001 (IEEE Cat. No.01EX489)》;20010504;279-282 * |
五种常用的图片格式及其是否有数据压缩的总结;ZhangPYi;《https://www.cnblogs.com/huty/p/8519033.html》;20151012;1-4 * |
基于自索引的DBF压缩查询工具研究;刘胜飞等;《计算机应用研究》;20090228;628-630 * |
Also Published As
Publication number | Publication date |
---|---|
CN111009017A (en) | 2020-04-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106453572B (en) | Method and system based on Cloud Server synchronous images | |
CN112602088B (en) | Method, system and computer readable medium for improving quality of low light images | |
CN105744292A (en) | Video data processing method and device | |
CN104580907A (en) | Anti-shake photographing method and device | |
CN110930467A (en) | Image processing method, electronic device and readable storage medium | |
US20150146224A1 (en) | Image processing apparatus and image processing method | |
CN112950738B (en) | Rendering engine processing method and device, storage medium and electronic equipment | |
CN107220000A (en) | Picture compression method and picture compression device | |
KR20190133602A (en) | Apparatus and method for successive multi-frame image denoising | |
CN105094975A (en) | Method and device for calling application program | |
CN111009017B (en) | Picture compression method and device, storage medium and computer equipment | |
CN106528758B (en) | Picture selection method and device | |
CN110727810A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN108924624B (en) | Information processing method and device | |
CN110545427A (en) | PDF document compression method and device and electronic equipment | |
CN111507067A (en) | Acquisition method for displaying formula picture, and method and device for transferring formula picture | |
CN110969587A (en) | Image acquisition method and device and electronic equipment | |
CN109710783B (en) | Picture loading method and device, storage medium and server | |
CN108519962B (en) | Font display method and apparatus applied to android system, and terminal device | |
US20120179676A1 (en) | Method and apparatus for annotating image in digital camera | |
CN109218597A (en) | Method and device for shooting image by intelligent terminal | |
CN108900929A (en) | A kind of image watermark signature processing method and processing device | |
CN111143293A (en) | Metadata acquisition method, device, equipment and computer readable storage medium | |
CN104462294B (en) | A kind of image searching method, device and terminal | |
JP5871293B2 (en) | Mobile terminal and image classification method |
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 |