CN113706640A - Method, device, storage medium and electronic equipment for compressing image - Google Patents

Method, device, storage medium and electronic equipment for compressing image Download PDF

Info

Publication number
CN113706640A
CN113706640A CN202110897433.1A CN202110897433A CN113706640A CN 113706640 A CN113706640 A CN 113706640A CN 202110897433 A CN202110897433 A CN 202110897433A CN 113706640 A CN113706640 A CN 113706640A
Authority
CN
China
Prior art keywords
image
compressed
compression
compressing
compression mode
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.)
Pending
Application number
CN202110897433.1A
Other languages
Chinese (zh)
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110897433.1A priority Critical patent/CN113706640A/en
Publication of CN113706640A publication Critical patent/CN113706640A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The invention discloses a method and a device for compressing an image, a storage medium and electronic equipment. Wherein, the method comprises the following steps: acquiring an image to be compressed; analyzing the image characteristics of the image to be compressed, and determining a compression mode corresponding to the image to be compressed; and compressing the image to be compressed by adopting a compression mode to obtain a target image. The invention solves the technical problem of poor image compression quality when the image is compressed in the prior art.

Description

Method, device, storage medium and electronic equipment for compressing image
Technical Field
The present invention relates to the field of image processing, and in particular, to a method, an apparatus, a storage medium, and an electronic device for compressing an image.
Background
In the production of electronic game pieces, the material representation of three-dimensional models generally depends on a large number of map images containing different information. In the production link of art assets, because the requirements on the accuracy of the maps are different, the output and processing flows of different types of maps are often different, taking a fixed color map as an example, hue deviation generated by a traditional compression and sampling algorithm is difficult to be perceived by human eyes, but the hue deviation is used for calculating the normal map of an illumination included angle, and an error result generated by the traditional algorithm generates obvious visual difference after data analysis and illumination calculation, so that in order to ensure the quality of a compressed result of the normal map, the modification of the size of the normal map usually needs a processing flow of high-modulus baking and low-modulus output, and for a large game, trivial and single map operation consumes a large amount of production cost, and the risk of output errors is increased due to instability caused by manual operation.
With the development of the industry and the progress of hardware equipment, people have higher and higher requirements on the three-dimensional rendering quality, and a high-precision mapping efficient lossless compression scheme becomes a technical problem to be solved urgently in the three-dimensional mobile industry.
At present, the following two ways are generally adopted in the related art to perform compression processing on a map:
the first method is as follows: the chartlet image is stored using a lossless format (e.g., TGA, TIFF, etc.), and the size modification process for a large number of chartlets is done using Photoshop.
The second method comprises the following steps: and repeating the traditional normal baking process, baking the normal information of the high mode to the map of the low mode by utilizing carving software such as Zbrush, and outputting the obtained normal map, and then performing format conversion by utilizing other software.
Although both of the above two methods can realize compression processing of the map, in the first method, the size of the game bag body is increased because the size of the image in a lossless format such as TGA is large; in addition, compared with a DDS format, lossless formats such as TGA have lower efficiency in the loading, parsing, and reading links, so that the first mode still has the problem of slow image loading, and the like.
In the second mode, the process of compressing the image is complicated, if the number of the stickers to be processed is huge, the output is finished by only manual operation of art makers, errors are easy to occur in complicated mechanical operation, and the errors are random and irregular, so that the errors are difficult to perceive, and the problems that the output efficiency is low and the image compression quality cannot be guaranteed exist when the second mode is adopted for image compression.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a storage medium and electronic equipment for compressing an image, which are used for at least solving the technical problem of poor image compression quality when the image is compressed in the prior art.
According to an aspect of an embodiment of the present invention, there is provided a method of compressing an image, including: acquiring an image to be compressed; analyzing the image characteristics of the image to be compressed, and determining a compression mode corresponding to the image to be compressed; and compressing the image to be compressed by adopting a compression mode to obtain a target image.
Further, the method of compressing an image further comprises: carrying out image sampling on an image to be compressed to obtain a first image; performing feature extraction on the first image to obtain image features corresponding to the image to be compressed, wherein the image features at least comprise: the method comprises the following steps of obtaining a file name corresponding to an image to be compressed, a pixel format corresponding to the image to be compressed and an image mode corresponding to the image to be compressed; and determining a compression mode corresponding to the image to be compressed according to the image characteristics.
Further, the method of compressing an image further comprises: after feature extraction is carried out on a first image to obtain image features corresponding to an image to be compressed, whether the first image contains a transparent channel is detected according to a pixel format to obtain a first detection result, wherein the transparent channel is used for at least storing transparency information and gray information in the first image; and carrying out scaling processing on the first image according to the first detection result to obtain a second image.
Further, the method of compressing an image further comprises: under the condition that the first image is detected to contain a transparent channel, channel splitting processing is carried out on the first image to obtain a third image and a fourth image, wherein the third image is an image containing the transparent channel, and the fourth image is an image containing color information; respectively carrying out zooming processing on the third image and the fourth image to obtain a zoomed third image and a zoomed fourth image; and merging the zoomed third image and the zoomed fourth image to obtain a second image.
Further, the method of compressing an image further comprises: and under the condition that the transparent channel is not included in the first image, carrying out scaling processing on the first image to obtain a second image.
Further, the method of compressing an image further comprises: before the first image is zoomed according to the first detection result to obtain a second image, comparing the size of the image corresponding to the first image with the size of a preset size to obtain a comparison result; receiving a control instruction fed back by the target object according to the comparison result; and adjusting the size of the first image according to the control instruction.
Further, the method of compressing an image further comprises: performing format conversion on the image to be compressed to obtain a sixth image, wherein the sixth image comprises image information contained in the image to be compressed; and compressing the sixth image by adopting a compression mode to obtain a target image.
Further, the method of compressing an image further comprises: before the sixth image is compressed in a compression mode to obtain the target image, detecting whether image information corresponding to the image to be compressed comprises preset data and/or a transparent channel to obtain a second detection result, wherein the preset data is the image data subjected to compression processing; and determining whether the sixth image is compressed in a compression mode or not according to the second detection result.
Further, the method of compressing an image further comprises: under the condition that the compression mode is the first compression mode, if the image information contains preset data but does not contain a transparent channel and a compression identifier for forbidding compression of the sixth image, the sixth image is compressed by adopting the first compression mode; and if the image information does not contain preset data, including a transparent channel or a compressed identifier, generating warning information.
Further, the method of compressing an image further comprises: under the condition that the compression mode is the second compression mode, if the image information contains preset data and a transparent channel but does not contain a compression identifier for forbidding compression of the sixth image, the sixth image is compressed by adopting the second compression mode; and if the image information does not contain preset data and a transparent channel, including a compression identifier, generating warning information.
Further, the method of compressing an image further comprises: and if the compression method is the third compression method, performing compression processing on the sixth image by adopting the third compression method.
Further, the method of compressing an image further comprises: controlling a main thread to perform task distribution to a plurality of sub-threads, wherein the plurality of sub-threads at least comprise a first sub-thread, and the first sub-thread is used for analyzing, converting the format and compressing the image to be compressed; and controlling the monitoring thread to monitor the first sub-thread to obtain an abnormal result, and feeding the abnormal result back to the interface control thread of the graphical user interface so that the graphical user interface displays the abnormal result.
Further, the method of compressing an image further comprises: acquiring a parameter to be adjusted corresponding to an image to be compressed; adjusting the parameters to be adjusted to obtain adjusted parameters; and compressing the image to be compressed based on the adjusted parameters to obtain the target image.
Further, the method of compressing an image further comprises: acquiring an operation record of a target object on a preset system, wherein the preset system is used for compressing an image to be compressed; and storing the operation record.
According to another aspect of the embodiments of the present invention, there is also provided a method of compressing an image, including: selecting an image to be compressed on an interactive interface, and selecting at least one adjusting parameter; calling a sampling function to sample an image to be compressed to obtain a sampling result; determining a compression mode corresponding to the image to be compressed based on the sampling result and at least one adjusting parameter; and compressing the image to be compressed by adopting a compression mode to obtain a target image.
According to another aspect of the embodiments of the present invention, there is also provided an apparatus for compressing an image, including: the acquisition module is used for acquiring an image to be compressed; the analysis module is used for analyzing the image characteristics of the image to be compressed and determining a compression mode corresponding to the image to be compressed; and the compression module is used for compressing the image to be compressed by adopting a compression mode to obtain the target image.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the above-mentioned method of compressing an image when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to carry out a method for running the programs, wherein the programs are arranged such that, when run, they perform the method for compressing an image as described above.
In the embodiment of the invention, a mode of compressing an image by using a compression mode corresponding to the image to be compressed is adopted, after the image to be compressed is obtained, the compression mode corresponding to the image to be compressed is determined by analyzing the image characteristics of the image to be compressed, and the compression mode is adopted to compress the image to be compressed so as to obtain the target image.
In the process, the compression mode is determined by the image characteristics of the image to be compressed, so that the compression mode is an optimal compression strategy for compressing the image to be compressed, and the quality of image compression can be ensured by compressing the image to be compressed by adopting the compression mode. In addition, in the process, the compression mode can be determined only by performing characteristic analysis on the image to be compressed, and then the image to be compressed is directly compressed by using the compression mode without modifying complicated procedures, so that the cost of image compression is saved, and the efficiency of image compression is improved.
Therefore, the scheme provided by the application achieves the purpose of compressing the image, thereby realizing the technical effect of improving the image compression quality and further solving the technical problem of poor image compression quality in the prior art when the image is compressed.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of a method of compressing an image according to an embodiment of the invention;
FIG. 2 is a schematic diagram of an alternative image to be compressed according to an embodiment of the invention;
FIG. 3 is a schematic illustration of an alternative target image according to an embodiment of the invention;
FIG. 4 is a schematic illustration of an alternative target image according to an embodiment of the invention;
FIG. 5 is a flow diagram of an alternative method of compressing an image according to an embodiment of the invention;
FIG. 6 is a schematic view of an alternative graphical interface in accordance with embodiments of the present invention;
FIG. 7 is a schematic diagram of an alternative default system in accordance with embodiments of the present invention;
FIG. 8 is a flow diagram of a method of compressing an image according to an embodiment of the invention;
fig. 9 is a schematic diagram of an apparatus for compressing an image according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present invention, there is provided an embodiment of a method of compressing an image, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system, such as a set of computer-executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
In addition, it should be noted that, in this embodiment, the electronic device is used to compress an image to be compressed, that is, the electronic device is an execution main body of the method provided in this embodiment, where the electronic device may be, but is not limited to, a desktop computer, a notebook computer, a smart tablet, a smart phone, and the like.
Fig. 1 is a flowchart of a method of compressing an image according to an embodiment of the present invention, as shown in fig. 1, the method including the steps of:
step S102, obtaining an image to be compressed.
In step S102, the image to be compressed may be, but not limited to, a map image in a game scene, where the map image may be used to make a material of a virtual three-dimensional model in the game scene, where the map image may be, but not limited to, a DDS (direct Draw surface) map, and optionally, the DDS map may be a mixed map, a normal map, and an inherent color map.
In an alternative embodiment, the user may input the image to be compressed to the electronic device through an input unit (e.g., a scanner) of the electronic device, so that the electronic device performs the compression processing on the image to be compressed.
In another alternative embodiment, the electronic device receives a control instruction input by a user, and acquires the image to be compressed from a preset storage area according to the control instruction, for example, the user inputs a storage address for storing the image to be compressed to the electronic device, and the electronic device acquires the image to be compressed from the storage address.
And step S104, analyzing the image characteristics of the image to be compressed, and determining the compression mode corresponding to the image to be compressed.
In step S104, the image features of the image to be compressed at least include: the method comprises the steps that a file name corresponding to an image to be compressed, a pixel format corresponding to the image to be compressed and an image mode corresponding to the image to be compressed are determined, wherein a mapping type corresponding to the image to be compressed is determined according to a uniquely identifiable key word contained in the file name corresponding to the image to be compressed, for example, if the file name of the image to be compressed contains'm', the image to be compressed can be determined to be a mixed mapping; for another example, if the file name of the image to be compressed contains "_ n", the image to be compressed can be determined to be a normal map; for another example, if it is detected that the file name of the image to be compressed contains "_ d", the image to be compressed may be determined to be an inherent color map. In addition, the pixel format corresponding to the image to be compressed represents the compression format corresponding to the original image, including but not limited to DXT1 format, DXT5 format, R8G8B8a8 format, and the like; the image pattern represents channel information corresponding to an image to be compressed, for example, an original image includes a color channel (e.g., RGB channel) and a transparent channel (e.g., Alpha channel).
As can be seen from the above, the electronic device can determine the type of the map corresponding to the image to be compressed, the compression format corresponding to the original image, the channel information, and the like by analyzing the image to be compressed. And the electronic equipment can perform compression processing on the image to be compressed by analyzing the image characteristics.
It should be noted that the image characteristics corresponding to different images to be compressed are different, and the compression method of the image to be compressed is determined by analyzing the image characteristics, so that the compression method can be more adaptive to the image to be compressed, and the compression quality of the image can be improved by compressing the image to be compressed by using the compression method.
And S106, compressing the image to be compressed by adopting a compression mode to obtain a target image.
Optionally, fig. 2 is an image to be compressed, and fig. 3 and 4 are target images obtained by compressing the image to be compressed, where the size of the image to be compressed is 2048 × 2048, the image to be compressed includes 7 corner color maps and 212 engineering maps, the total number of the corner color maps is 60.0MB, and the total number of the engineering maps is 1.18 GB. Fig. 3 shows the result of adjusting the size of the image to be compressed to 1024 × 1024 and then compressing the image to be compressed after the size adjustment, wherein in fig. 3, the total of 7 corner color maps is 14.4MB, the total of 212 engineering maps is 0.44GB, the compression rate is 37.3%, and the processing efficiency is 17 seconds. . Fig. 4 shows the result of adjusting the size of the image to be compressed to 512 × 512 and then compressing the image to be compressed after the size is adjusted, wherein in fig. 4, 3.54MB of 7 corner color maps and 0.12GB of 212 engineering maps are provided, the compression rate is 10.1%, and the processing efficiency is 16 seconds.
As can be seen from fig. 2 to 4, for images to be compressed with different sizes, the same compression method is adopted, the file sizes of the obtained target images are different, the compression rates are also different, but the fidelity of the target images is not reduced, that is, the scheme provided by the present application can ensure the image compression quality.
Based on the solutions defined in steps S102 to S106, it can be known that, in the embodiment of the present invention, a mode of compressing an image using a compression mode corresponding to an image to be compressed is adopted, after the image to be compressed is obtained, a compression mode corresponding to the image to be compressed is determined by analyzing image features of the image to be compressed, and the compression mode is adopted to compress the image to be compressed, so as to obtain a target image.
It is easy to note that, in the above process, the compression method is determined by the image characteristics of the image to be compressed, and therefore, the compression method is an optimal compression strategy for performing compression processing on the image to be compressed, and the quality of image compression can be ensured by performing compression processing on the image to be compressed by using the compression method. In addition, in the process, the compression mode can be determined only by performing characteristic analysis on the image to be compressed, and then the image to be compressed is directly compressed by using the compression mode without modifying complicated procedures, so that the cost of image compression is saved, and the efficiency of image compression is improved.
Therefore, the scheme provided by the application achieves the purpose of compressing the image, thereby realizing the technical effect of improving the image compression quality and further solving the technical problem of poor image compression quality in the prior art when the image is compressed.
In an optional embodiment, after the image to be compressed is acquired, the electronic device analyzes image features of the image to be compressed to determine a compression mode corresponding to the image to be compressed. Specifically, the electronic device performs image sampling on an image to be compressed to obtain a first image, performs feature extraction on the first image to obtain image features corresponding to the image to be compressed, and then determines a compression mode corresponding to the image to be compressed according to the image features.
Optionally, fig. 5 shows a flowchart of an optional method for compressing an Image, and as can be seen from fig. 5, the electronic device first performs Image sampling on the Image to be compressed, where the electronic device may perform Image sampling on the Image to be compressed using PIL (Python Image Library). The PIL may implement image processing functions of the image to be compressed, such as changing the size of the image to be compressed, rotating the image to be compressed, performing format conversion on the image to be compressed, performing color field space conversion, interpolation, filtering, and the like on the image to be compressed.
Further, after the first image is subjected to feature extraction to obtain image features corresponding to the image to be compressed, the electronic device detects whether the first image contains a transparent channel according to the pixel format to obtain a first detection result, and performs scaling processing on the first image according to the first detection result to obtain a second image. The transparent channel is used for storing at least transparency information and gray scale information in the first image, wherein the gray scale information can include but is not limited to self-luminous intensity information, roughness information and metal degree information.
Optionally, when it is detected that the first image includes a transparent channel, the channel splitting processing is performed on the first image to obtain a third image and a fourth image, the scaling processing is performed on the third image and the fourth image respectively to obtain a scaled third image and a scaled fourth image, and then the scaling processing is performed on the scaled third image and the scaled fourth image to obtain a second image. The third image is an image containing a transparent channel, and the fourth image is an image containing color information.
And under the condition that the transparent channel is not included in the first image, carrying out scaling processing on the first image to obtain a second image.
Optionally, in fig. 5, after performing image sampling on the image to be compressed to obtain the first image, the electronic device performs size scaling on the first image. Because the conventional scaling algorithm cuts out the pixel values of the color channels (e.g., RGB channels) in the first image according to the transparent channels (e.g., Alpha channels), and the transparent channels are used as masks, that is, the data corresponding to the color channels and the data corresponding to the transparent channels are multiplied, so that the numerical values corresponding to the color channels of the finally output image do not correspond to the numerical values corresponding to the color channels of the original image (i.e., the image to be compressed), and thus the compressed image has a distortion problem compared with the original image. Therefore, before the first image is scaled, it is determined whether the first image contains a transparent channel (i.e., a channel in fig. 5). If the first image contains a transparent channel, the first image is subjected to channel splitting, the first image is split into an RGB object (namely, a fourth image) and an A object (namely, a third image), then the two images are respectively subjected to scaling processing to obtain a scaled fourth image and a scaled third image, the Humming filtering algorithm can be used in the process to reduce the generation of noise, and then the two scaled images are subjected to channel merging.
In addition, when the transparent channel is not included in the first image, the first image is directly subjected to size scaling without judgment.
In an optional embodiment, before the first image is scaled according to the first detection result to obtain the second image, the electronic device compares the size of the image corresponding to the first image with a preset size to obtain a comparison result, receives a control instruction fed back by the target object according to the comparison result, and then adjusts the size of the first image according to the control instruction. The target object is a user operating the electronic device, that is, in the present application, the user may select whether to perform the enlarging process and the reducing process on the first image or prohibit the user from adjusting the size of the first image according to the comparison result displayed by the electronic device.
It should be noted that, in practical applications, the user may determine the target size to be adjusted for the first image based on experience. In addition, in order to prevent the user from performing an erroneous operation on the electronic device, before the first image is scaled, the electronic device needs to compare the size of the first image with the size of the target, so that when the first image is scaled from a small size to a large size, the electronic device can record the warning information and skip the processing flow of the image, thereby avoiding a redundant meaningless large-size image, as shown in fig. 5, comparing the size of the original map with the size of the target.
For example, a plurality of images to be compressed with different sizes are stored in a preset map directory, a user needs to compress a 2k image to a size of 1024 × 1024, and the map directory has 512 × 512 images, and if the PIL is directly called to implement scaling of the image, the 512 × 512 image is erroneously enlarged to 1024 × 1024, so before the image is scaled, size comparison needs to be performed to prevent an erroneous operation of the user.
In addition, it should be noted that, in the process of scaling the first image, the first image may be scaled into an equilateral rectangle, that is, the second image obtained after the first image is scaled is a square, so as to avoid the display problem of sampling deviation or non-uniform blurring.
In an optional embodiment, after the first image is zoomed to obtain the second image, the second image is subjected to feature extraction to obtain image features of the image to be compressed, a compression mode corresponding to the image to be compressed is determined according to the image features, and then the electronic device compresses the image to be compressed by adopting the compression mode to obtain the target image. Specifically, the electronic device performs format conversion on the image to be compressed to obtain a sixth image, and performs compression processing on the sixth image in a compression mode to obtain the target image. The sixth image comprises image information contained in the image to be compressed.
It should be noted that the image format of the sixth image is an undistorted mapping format, as shown in fig. 5, the electronic device converts the image to be compressed into an image in a lossless format, and temporarily stores the image converted into the lossless format, for example, the image format of the sixth image may be, but is not limited to, a TGA format, a TIFF format, and the like. After the sixth image is obtained, the electronic device temporarily stores the sixth image.
In addition, it should be noted that the problem of image compression quality reduction caused by compression processing on the image in the lossy format can be avoided by storing the image to be compressed as the image in the lossless format and then compressing the image in the lossless format.
In an optional embodiment, before the sixth image is compressed in a compression manner to obtain the target image, the electronic device detects whether image information corresponding to the image to be compressed includes preset data and/or a transparent channel to obtain a second detection result, and determines whether the sixth image is compressed in the compression manner according to the second detection result. The preset data is image data after compression processing.
Optionally, after the image to be compressed is stored as an image in a lossless format, the electronic device calls a function of TexConv using an operating system interface of python, converts the scaled image temporarily stored in the lossless format into a corresponding DDS texture file using a compression policy, and releases (or deletes) the temporarily stored file.
Optionally, in a case that the compression mode is the first compression mode, if the image information includes preset data but does not include a transparent channel and a compression identifier for prohibiting compression of the sixth image, performing compression processing on the sixth image by using the first compression mode; and if the image information does not contain preset data, including a transparent channel or a compressed identifier, generating warning information.
It should be noted that the first compression mode may be a DXT1 mode, and the image to be compressed in this format usually stores a texture map of compressed data without a transparent channel, so in practical applications, as shown in fig. 5, the electronic device needs to determine the following:
the electronic equipment detects whether a transparent channel exists in the image to be compressed, and if so, the electronic equipment records the problem, generates warning information and reports errors; if the compressed image does not exist, detecting whether an identification mark (namely the compression mark) which is not expected to be compressed exists in the image to be compressed, if so, recording the problem and providing warning information for a user to remind the user that the quality of the compressed image is damaged possibly caused by the format; if the image to be compressed does not have the problem, format conversion is carried out on the temporarily stored lossless image file according to the DXT1 format, and a target image (namely a DDS image) is obtained.
Optionally, in a case that the compression mode is the second compression mode, if the image information includes preset data and a transparent channel but does not include a compression identifier for prohibiting compressing the sixth image, the sixth image is compressed by using the second compression mode; and if the image information does not contain preset data and a transparent channel, including a compression identifier, generating warning information.
It should be noted that the second compression mode may be a DXT5 mode, and the image to be compressed in this format usually stores a texture map containing transparent channels of compressed data, so in practical applications, as shown in fig. 5, the electronic device needs to determine as follows:
the electronic equipment detects whether an identification mark (namely the compression mark) which is not expected to be compressed exists in the image to be compressed, if so, the electronic equipment records the problem and provides warning information for a user to remind the user that the quality of the compressed image is damaged possibly caused by the format; if the image to be compressed does not have the problem, format conversion is carried out on the temporarily stored lossless image file according to the DXT5 format, and a target image (namely a DDS image) is obtained.
Optionally, when the compression mode is the third compression mode, the sixth image is compressed by using the third compression mode.
It should be noted that the third compression method may be an R8G8B8A8 method, and the image to be compressed in this format usually stores a lossless texture map, so in practical applications, as shown in fig. 5, the electronic device does not need to perform logical judgment of the above problem, and directly performs format conversion to obtain the target image (i.e., DDS image).
In an alternative embodiment, in order to improve the processing efficiency of compressing the image, in this embodiment, the electronic device executes the image compression flow in a multi-thread manner. Optionally, in the present application, the electronic device may implement a processing procedure of graphical multithreading in a form of combining graphical interactive design and multithreading function, so as to reduce the problem of high threshold existing in the existing compression method and improve the execution efficiency of image compression, including but not limited to the functions provided by the Pyside 2-based module and the native threading module.
Specifically, the electronic device controls the main thread to distribute tasks to the plurality of sub-threads, controls the monitoring thread to monitor the first sub-thread to obtain an abnormal result, and feeds the abnormal result back to the interface control thread of the graphical user interface, so that the graphical user interface displays the abnormal result. The plurality of sub-threads at least comprise a first sub-thread, and the first sub-thread is used for analyzing, converting the format and compressing the image to be compressed.
It should be noted that, in the multithread design provided by this embodiment, from the perspective of a user, after a processing process starts, cancellation operation of the user is responded in real time through accurate thread management, so that loss is stopped in time when the user performs an incorrect operation; the method comprises the steps that a thread pool is used for multithreading, namely, a main thread controls the distribution of tasks, after a sub-thread completes the processing of a single image, the main thread is activated and a dispatching function of the main thread is called, the main thread decides to distribute sub-tasks or recycle the sub-thread according to the allowance of the task pool, and returns processing results, warning logs and other information, so that high-efficiency flow closed loop is realized on the logic of thread management, and the processing speed of the method is guaranteed.
For example, in the flowchart shown in fig. 5, the electronic device first determines whether the parameter to be adjusted exposed by the user to the electronic device is valid, and if the parameter to be adjusted is invalid, the electronic device does not perform image compression on the image to be compressed; if the parameter to be adjusted is valid, the electronic device creates a management main thread and a thread pool. The electronic device then creates sub-threads through which to record the anomalies produced during the image compression process and to skip the task in which the anomalies occurred. In addition, after the lossless format image is converted into the DDS image, the sub thread running the image compression task is released, and the temporarily stored image is deleted. And meanwhile, the main thread calls the task pool allowance from the management thread, if the task pool allowance is empty, the sub-thread is released, and the log of the compressed image is sorted and output.
In addition, in the above process, if the electronic device receives a termination operation input by the user, the main thread stops and recovers all the sub-threads.
In addition, it should be noted that the electronic device can respond to the program execution abnormality, including but not limited to a read-write error, an authority error, a multi-thread conflict error, and the like of the temporary image.
In an optional embodiment, the electronic device obtains a parameter to be adjusted corresponding to the image to be compressed, adjusts the parameter to be adjusted to obtain an adjusted parameter, and then compresses the image to be compressed based on the adjusted parameter to obtain the target image.
Optionally, the parameter to be adjusted may be, but is not limited to, "target size", "keyword", "filter", "thread number", "input format", "output format", and operation that can be currently performed in the graphical interface shown in fig. 6.
It should be noted that, from the perspective of the user, the graphical interactive design exposes the most critical adjustable parameters (and the parameters to be adjusted), and simplifies the operation complexity of the user in a manner of combining graphics and text; the method is matched with a log window and a progress bar, information such as records, statistics, warnings and operation records is visually displayed to a user, and in the processing process, the most concerned information is screened out and presented in real time and summarized in a highlighted mode.
In another alternative embodiment, the electronic device may further obtain an operation record of the target object on the preset system, and store the operation record. The preset system is used for compressing the image to be compressed.
Optionally, the target object may be a user, the preset system may be a system for compressing an image to be compressed, and the preset system may include an electronic device. In addition, the electronic device can record the usage habits of the user and store the user operations in the form of files, including but not limited to recording information such as a file directory, a sampler type, a thread number, a keyword or a target size selected at the last time of use.
Optionally, fig. 7 shows a schematic structural diagram of the preset system, as can be seen from fig. 7, the system includes a graphical interface, a management thread (i.e., a main thread), an execution thread (i.e., a sub-thread), a policy decision model, and an image processing module, where the graphical interface is capable of displaying "target size", "keyword", "filter" (i.e., sampling algorithm), "thread number", "input format", "output format", and operations that can be currently executed, such as updating a progress bar, starting execution, and terminating a thread. The management thread can manage the thread pool and the task pool, and can acquire the next task and update the task pool. The execution thread can process the image and temporarily store the processed image. The execution thread calls a policy decision module in a policy library to realize specification judgment, compression format judgment, exception handling and the like of the image, and calls an image processing method in an image processing module to realize layer layering, image scaling, image loading and image storage of the image.
As can be seen from the above, according to the scheme provided by this embodiment, the image to be compressed is cut into an equilateral polygon according to the target size preset by the user, and the image types are distinguished by using the named form; analyzing an image to be compressed through an intelligent compression scheme, and automatically selecting an optimal compression strategy according to data obtained through analysis; utilizing a python third-party library PIL and a native system function to call a TexConv technology to complete resampling, scaling, compression and storage of an image to be compressed; the execution efficiency is optimized by combining the Pyside2 and python native multithreading modules with the processing flow. Therefore, the problems of poor stability, impaired compression quality and low efficiency in image compression work are solved. The scheme provided by the embodiment is particularly suitable for the situation that a large number of multi-type DDS maps are mixed and the requirement on compression quality is high.
According to an embodiment of the present invention, there is also provided an embodiment of a method for compressing an image, where fig. 8 is a flowchart of a method for compressing an image according to an embodiment of the present invention, as shown in fig. 8, the method includes the following steps:
step S802, selecting an image to be compressed on the interactive interface, and selecting at least one adjusting parameter.
Optionally, the interactive interface may be a graphical interface shown in fig. 6, and the user may select an image to be compressed by selecting a control for an image corresponding to a "target folder" in the graphical interface, where the image to be compressed is stored in an address shown in a text box in fig. 6.
In addition, the above adjustment parameter may be, but is not limited to, "target size", "keyword", "filter" (i.e. sampling algorithm), "thread number", "input format", and "output format" corresponding to the image to be compressed in fig. 6.
It should be noted that, after the electronic device reads the image to be compressed, the electronic device performs an analysis operation on the image to be compressed, so as to obtain the adjustment parameter corresponding to the image to be compressed, and display the value corresponding to the adjustment parameter on the interactive interface.
Step S804, a sampling function is called to perform sampling processing on the image to be compressed to obtain a sampling result.
In step S804, the electronic device may use a sampling function in the PIL (Python Image Library) to perform Image sampling on the Image to be compressed. The PIL may implement image processing functions of the image to be compressed, such as changing the size of the image to be compressed, rotating the image to be compressed, performing format conversion on the image to be compressed, performing color field space conversion, interpolation, filtering, and the like on the image to be compressed.
Optionally, after the electronic device performs sampling processing on the image to be compressed, an adoption result including the image feature of the image to be compressed may be obtained, where the image feature of the image to be compressed at least includes: the method comprises the steps that a file name corresponding to an image to be compressed, a pixel format corresponding to the image to be compressed and an image mode corresponding to the image to be compressed are determined, wherein a mapping type corresponding to the image to be compressed is determined according to a uniquely identifiable key word contained in the file name corresponding to the image to be compressed, for example, if the file name of the image to be compressed contains'm', the image to be compressed can be determined to be a mixed mapping; for another example, if the file name of the image to be compressed contains "_ n", the image to be compressed can be determined to be a normal map; for another example, if it is detected that the file name of the image to be compressed contains "_ d", the image to be compressed may be determined to be an inherent color map. In addition, the pixel format corresponding to the image to be compressed represents the compression format corresponding to the original image, including but not limited to DXT1 format, DXT5 format, R8G8B8a8 format, and the like; the image pattern represents channel information corresponding to an image to be compressed, for example, an original image includes a color channel (e.g., RGB channel) and a transparent channel (Alpha channel).
Step S806, determining a compression mode corresponding to the image to be compressed based on the sampling result and the at least one adjustment parameter.
In step S806, the electronic device may determine the type of the map corresponding to the image to be compressed, the compression format corresponding to the original image, the channel information, and the like by analyzing the sampling result. And the electronic equipment can perform compression processing on the image to be compressed by analyzing the image characteristics and the adjusting parameters.
It should be noted that the image characteristics corresponding to different images to be compressed are different, and the compression mode of the image to be compressed is determined by analyzing the image characteristics and the adjustment parameters, so that the compression mode can be more adaptive to the image to be compressed, and the compression quality of the image to be compressed can be improved by compressing the image to be compressed by using the compression mode. Moreover, the user can adjust the target size and the output format of the compressed image and the number of filters and threads required to be used in the compression process, so that the flexibility of image compression is improved.
And step S808, compressing the image to be compressed by adopting a compression mode to obtain a target image.
Optionally, fig. 2 is an image to be compressed, and fig. 3 and 4 are target images obtained by compressing the image to be compressed, where the size of the image to be compressed is 2048 × 2048, the image to be compressed includes 7 corner color maps and 212 engineering maps, the total number of the corner color maps is 60.0MB, and the total number of the engineering maps is 1.18 GB. Fig. 3 shows the result of adjusting the size of the image to be compressed to 1024 × 1024 and then compressing the image to be compressed after the size adjustment, wherein in fig. 3, the total of 7 corner color maps is 14.4MB, the total of 212 engineering maps is 0.44GB, the compression rate is 37.3%, and the processing efficiency is 17 seconds. . Fig. 4 shows the result of adjusting the size of the image to be compressed to 512 × 512 and then compressing the image to be compressed after the size is adjusted, wherein in fig. 4, 3.54MB of 7 corner color maps and 0.12GB of 212 engineering maps are provided, the compression rate is 10.1%, and the processing efficiency is 16 seconds.
As can be seen from fig. 2 to 4, for images to be compressed with different sizes, the same compression method is adopted, the file sizes of the obtained target images are different, the compression rates are also different, but the fidelity of the target images is not reduced, that is, the scheme provided by the present application can ensure the image compression quality.
In the embodiment of the invention, a mode of compressing an image by using a compression mode corresponding to the image to be compressed is adopted, the image to be compressed and at least one adjusting parameter are selected on an interactive interface, then a sampling function is called to sample the image to be compressed to obtain a sampling result, the compression mode corresponding to the image to be compressed is determined based on the sampling result and the at least one adjusting parameter, and finally the compression mode is adopted to compress the image to be compressed to obtain a target image.
In the process, the compression mode is determined by the image characteristics of the image to be compressed, so that the compression mode is an optimal compression strategy for compressing the image to be compressed, and the quality of image compression can be ensured by compressing the image to be compressed by adopting the compression mode. In addition, in the process, the compression mode can be determined only by performing characteristic analysis on the image to be compressed, and then the image to be compressed is directly compressed by using the compression mode without modifying complicated procedures, so that the cost of image compression is saved, and the efficiency of image compression is improved.
Therefore, the scheme provided by the application achieves the purpose of compressing the image, thereby realizing the technical effect of improving the image compression quality and further solving the technical problem of poor image compression quality in the prior art when the image is compressed.
It should be noted that, the process of compressing the image to be compressed has been described in detail in the above embodiments, and is not described herein again.
According to an embodiment of the present invention, there is also provided an embodiment of an apparatus for compressing an image, where fig. 9 is a schematic diagram of an apparatus for compressing an image according to an embodiment of the present invention, as shown in fig. 9, the apparatus includes: an acquisition module 901, an analysis module 903, and a compression module 905.
The acquiring module 901 is configured to acquire an image to be compressed;
an analysis module 903, configured to analyze image characteristics of an image to be compressed, and determine a compression mode corresponding to the image to be compressed;
and the compression module 905 is configured to perform compression processing on the image to be compressed by using a compression method to obtain a target image.
It should be noted that the obtaining module 901, the analyzing module 903, and the compressing module 905 correspond to steps S102 to S106 in the foregoing embodiment, and the three modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure in the foregoing embodiment.
Optionally, the analysis module includes: the device comprises a sampling module, an extraction module and a first determination module. The device comprises a sampling module, a compression module and a compression module, wherein the sampling module is used for sampling an image to be compressed to obtain a first image; the extraction module is used for extracting the characteristics of the first image to obtain the image characteristics corresponding to the image to be compressed, wherein the image characteristics at least comprise: the method comprises the following steps of obtaining a file name corresponding to an image to be compressed, a pixel format corresponding to the image to be compressed and an image mode corresponding to the image to be compressed; and the first determining module is used for determining a compression mode corresponding to the image to be compressed according to the image characteristics.
Optionally, the apparatus for compressing an image further comprises: the device comprises a first detection module and a first processing module. The first detection module is used for detecting whether the first image contains a transparent channel according to a pixel format after the first image is subjected to feature extraction to obtain image features corresponding to an image to be compressed, and obtaining a first detection result, wherein the transparent channel is used for at least storing transparency information and gray information in the first image; and the first processing module is used for carrying out scaling processing on the first image according to the first detection result to obtain a second image.
Optionally, the first processing module includes: the device comprises a splitting module, a second processing module and a merging module. The splitting module is used for performing channel splitting processing on the first image to obtain a third image and a fourth image under the condition that the first image is detected to contain a transparent channel, wherein the third image is an image containing the transparent channel, and the fourth image is an image containing color information; the second processing module is used for respectively carrying out zooming processing on the third image and the fourth image to obtain a zoomed third image and a zoomed fourth image; and the merging module is used for merging the zoomed third image and the zoomed fourth image to obtain a second image.
Optionally, the first processing module includes: and the third processing module is used for carrying out scaling processing on the first image to obtain a second image under the condition that the transparent channel is not included in the first image.
Optionally, the apparatus for compressing an image further comprises: the device comprises a comparison module, a receiving module and a first adjusting module. The comparison module is used for comparing the image size corresponding to the first image with the preset size before the first image is subjected to scaling processing according to the first detection result to obtain the second image, so as to obtain a comparison result; the receiving module is used for receiving a control instruction fed back by the target object according to the comparison result; and the first adjusting module is used for adjusting the size of the first image according to the control instruction.
Optionally, the compression module includes: a conversion module and a fourth processing module. The conversion module is used for performing format conversion on the image to be compressed to obtain a sixth image, wherein the sixth image comprises image information contained in the image to be compressed; and the fourth processing module is used for compressing the sixth image by adopting a compression mode to obtain the target image.
Optionally, the apparatus for compressing an image further comprises: a second detection module and a third determination module. The second detection module is used for detecting whether image information corresponding to an image to be compressed comprises preset data and/or a transparent channel before the sixth image is compressed in a compression mode to obtain a target image, and obtaining a second detection result, wherein the preset data is image data subjected to compression processing; and the third determining module is used for determining whether the sixth image is compressed in a compression mode or not according to the second detection result.
Optionally, the third determining module includes: a fifth processing module and a first generating module. The fifth processing module is configured to, if the image information includes preset data but does not include a transparent channel and a compression identifier that prohibits compression of the sixth image, perform compression processing on the sixth image in the first compression mode; and the first generation module is used for generating the warning information if the image information does not contain preset data, including a transparent channel or a compressed identifier.
Optionally, the third determining module includes: a sixth processing module and a second generating module. The sixth processing module is configured to, if the image information includes preset data and a transparent channel but does not include a compression identifier that prohibits compression of the sixth image, perform compression processing on the sixth image in the second compression mode when the compression mode is the second compression mode; and the second generation module is used for generating the warning information if the image information does not contain the preset data and the transparent channel and comprises the compression identifier.
Optionally, the third determining module includes: and the seventh processing module is used for performing compression processing on the sixth image by adopting the third compression mode under the condition that the compression mode is the third compression mode.
Optionally, the apparatus for compressing an image further comprises: the device comprises a first control module and a second control module. The first control module is used for controlling the main thread to distribute tasks to the plurality of sub-threads, wherein the plurality of sub-threads at least comprise a first sub-thread, and the first sub-thread is used for analyzing, converting formats and compressing images to be compressed; and the second control module is used for controlling the monitoring thread to monitor the first sub-thread to obtain an abnormal result and feeding the abnormal result back to the interface control thread of the graphical user interface so that the graphical user interface displays the abnormal result.
Optionally, the apparatus for compressing an image further comprises: the device comprises a first acquisition module, a second adjustment module and an eighth processing module. The first acquisition module is used for acquiring parameters to be adjusted corresponding to the images to be compressed; the second adjusting module is used for adjusting the parameters to be adjusted to obtain adjusted parameters; and the eighth processing module is used for compressing the image to be compressed based on the adjusted parameters to obtain the target image.
Optionally, the apparatus for compressing an image further comprises: the device comprises a second acquisition module and a storage module. The second acquisition module is used for acquiring an operation record of the target object to a preset system, wherein the preset system is used for compressing the image to be compressed; and the storage module is used for storing the operation records.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is configured to execute the above-mentioned method of compressing an image when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to carry out a method for running the programs, wherein the programs are arranged such that, when run, they perform the method for compressing an image as described above.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (18)

1. A method of compressing an image, comprising:
acquiring an image to be compressed;
analyzing the image characteristics of the image to be compressed, and determining a compression mode corresponding to the image to be compressed;
and compressing the image to be compressed by adopting the compression mode to obtain a target image.
2. The method according to claim 1, wherein analyzing the image features of the image to be compressed and determining the compression mode corresponding to the image to be compressed comprises:
carrying out image sampling on the image to be compressed to obtain a first image;
performing feature extraction on the first image to obtain image features corresponding to the image to be compressed, wherein the image features at least comprise: the file name corresponding to the image to be compressed, the pixel format corresponding to the image to be compressed and the image mode corresponding to the image to be compressed;
and determining a compression mode corresponding to the image to be compressed according to the image characteristics.
3. The method according to claim 2, wherein after the feature extraction is performed on the first image to obtain the image features corresponding to the image to be compressed, the method further comprises:
detecting whether a transparent channel is included in the first image according to the pixel format to obtain a first detection result, wherein the transparent channel is used for at least storing transparency information and gray information in the first image;
and carrying out scaling processing on the first image according to the first detection result to obtain a second image.
4. The method of claim 3, wherein scaling the first image according to the first detection result to obtain a second image comprises:
under the condition that the first image is detected to contain the transparent channel, channel splitting processing is carried out on the first image to obtain a third image and a fourth image, wherein the third image is an image containing the transparent channel, and the fourth image is an image containing color information;
respectively carrying out zooming processing on the third image and the fourth image to obtain a zoomed third image and a zoomed fourth image;
and merging the zoomed third image and the zoomed fourth image to obtain the second image.
5. The method of claim 3, wherein scaling the first image according to the first detection result to obtain a second image comprises:
and under the condition that the transparent channel is not included in the first image, carrying out scaling processing on the first image to obtain the second image.
6. The method of claim 3, wherein before scaling the first image according to the first detection result to obtain a second image, the method further comprises:
comparing the image size corresponding to the first image with a preset size to obtain a comparison result;
receiving a control instruction fed back by the target object according to the comparison result;
and adjusting the size of the first image according to the control instruction.
7. The method according to claim 1, wherein compressing the image to be compressed by the compression method to obtain a target image comprises:
performing format conversion on the image to be compressed to obtain a sixth image, wherein the sixth image comprises image information contained in the image to be compressed;
and compressing the sixth image by adopting the compression mode to obtain the target image.
8. The method according to claim 7, wherein before the sixth image is compressed by the compression method to obtain the target image, the method further comprises:
detecting whether image information corresponding to the image to be compressed comprises preset data and/or a transparent channel or not to obtain a second detection result, wherein the preset data is image data subjected to compression processing;
and determining whether the sixth image is compressed by adopting the compression mode or not according to the second detection result.
9. The method according to claim 8, wherein determining whether to perform compression processing on the sixth image in the compression manner according to the second detection result comprises:
if the image information contains the preset data but does not contain the transparent channel and a compression identifier for prohibiting compressing the sixth image, compressing the sixth image by adopting the first compression mode;
and if the image information does not contain the preset data, including the transparent channel or the compressed identifier, generating warning information.
10. The method according to claim 8, wherein determining whether to perform compression processing on the sixth image in the compression manner according to the second detection result comprises:
if the image information contains the preset data and the transparent channel but does not contain a compression identifier for prohibiting compressing the sixth image, compressing the sixth image by adopting the second compression mode under the condition that the compression mode is the second compression mode;
and if the image information does not contain the preset data and the transparent channel, including the compressed identification, generating warning information.
11. The method according to claim 8, wherein determining whether to perform compression processing on the sixth image in the compression manner according to the second detection result comprises:
and if the compression mode is a third compression mode, performing compression processing on the sixth image by adopting the third compression mode.
12. The method of claim 7, further comprising:
controlling a main thread to perform task distribution to a plurality of sub-threads, wherein the plurality of sub-threads at least comprise a first sub-thread, and the first sub-thread is used for analyzing, converting the format and compressing the image to be compressed;
and controlling a monitoring thread to monitor the first sub-thread to obtain an abnormal result, and feeding the abnormal result back to an interface control thread of a graphical user interface so that the graphical user interface displays the abnormal result.
13. The method of claim 1, further comprising:
acquiring a parameter to be adjusted corresponding to the image to be compressed;
adjusting the parameter to be adjusted to obtain an adjusted parameter;
and compressing the image to be compressed based on the adjusted parameters to obtain the target image.
14. The method of claim 1, further comprising:
acquiring an operation record of a target object to a preset system, wherein the preset system is used for compressing the image to be compressed;
and storing the operation record.
15. A method of compressing an image, comprising:
selecting an image to be compressed on an interactive interface, and selecting at least one adjusting parameter;
calling a sampling function to perform sampling processing on the image to be compressed to obtain a sampling result;
determining a compression mode corresponding to the image to be compressed based on the sampling result and the at least one adjusting parameter;
and compressing the image to be compressed by adopting the compression mode to obtain a target image.
16. An apparatus for compressing an image, comprising:
the acquisition module is used for acquiring an image to be compressed;
the analysis module is used for analyzing the image characteristics of the image to be compressed and determining a compression mode corresponding to the image to be compressed;
and the compression module is used for compressing the image to be compressed by adopting the compression mode to obtain a target image.
17. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of compressing an image as claimed in any one of claims 1 to 15 when executed.
18. An electronic device, wherein the electronic device comprises one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is arranged to perform the method of compressing an image of any one of claims 1 to 15 when run.
CN202110897433.1A 2021-08-05 2021-08-05 Method, device, storage medium and electronic equipment for compressing image Pending CN113706640A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110897433.1A CN113706640A (en) 2021-08-05 2021-08-05 Method, device, storage medium and electronic equipment for compressing image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110897433.1A CN113706640A (en) 2021-08-05 2021-08-05 Method, device, storage medium and electronic equipment for compressing image

Publications (1)

Publication Number Publication Date
CN113706640A true CN113706640A (en) 2021-11-26

Family

ID=78651678

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110897433.1A Pending CN113706640A (en) 2021-08-05 2021-08-05 Method, device, storage medium and electronic equipment for compressing image

Country Status (1)

Country Link
CN (1) CN113706640A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116193242A (en) * 2023-04-24 2023-05-30 北京城建智控科技股份有限公司 Image analysis and transmission method of camera device
CN116245710A (en) * 2023-05-11 2023-06-09 中国铁路设计集团有限公司 Dynamic scheduling method for mass oblique photography model based on illusion engine and thread pool

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109118566A (en) * 2018-09-13 2019-01-01 网易(杭州)网络有限公司 Compression method, device, storage medium and the electronic device of textures
CN110189384A (en) * 2018-02-22 2019-08-30 深圳市萌蛋互动网络有限公司 Method for compressing image, device, computer equipment and storage medium based on Unity3D

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110189384A (en) * 2018-02-22 2019-08-30 深圳市萌蛋互动网络有限公司 Method for compressing image, device, computer equipment and storage medium based on Unity3D
CN109118566A (en) * 2018-09-13 2019-01-01 网易(杭州)网络有限公司 Compression method, device, storage medium and the electronic device of textures

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116193242A (en) * 2023-04-24 2023-05-30 北京城建智控科技股份有限公司 Image analysis and transmission method of camera device
CN116193242B (en) * 2023-04-24 2023-07-14 北京城建智控科技股份有限公司 Image analysis and transmission method of camera device
CN116245710A (en) * 2023-05-11 2023-06-09 中国铁路设计集团有限公司 Dynamic scheduling method for mass oblique photography model based on illusion engine and thread pool
CN116245710B (en) * 2023-05-11 2023-07-18 中国铁路设计集团有限公司 Dynamic scheduling method for mass oblique photography model based on illusion engine and thread pool

Similar Documents

Publication Publication Date Title
US8218887B2 (en) Enhanced method of multilayer compression of PDF (image) files using OCR systems
CN107797739B (en) Mobile terminal, display control method and device thereof, and computer-readable storage medium
CN113706640A (en) Method, device, storage medium and electronic equipment for compressing image
US7978922B2 (en) Compressing images in documents
US20170312634A1 (en) System and method for personalized avatar generation, especially for computer games
US20060187241A1 (en) Lossless manipulation of media objects
CN111553923B (en) Image processing method, electronic equipment and computer readable storage medium
CN109375983B (en) Method for automatically adjusting input method window in terminal
CN109978805A (en) It takes pictures processing method, device, mobile terminal and storage medium
JP5164692B2 (en) Image processing apparatus, image processing method, and program
US20140071168A1 (en) Method for automatically generating presentation slides containing picture elements
CN106713689A (en) Picture uploading method and device
WO2001063558A2 (en) System and method for image processing
CN111228801A (en) Rendering method and device of game scene, storage medium and processor
WO2024094077A1 (en) Cloud desktop image processing method, image processing method, device, and storage medium
US9407835B2 (en) Image obtaining method and electronic device
CN111062868B (en) Image processing method, device, machine readable medium and equipment
US7424147B2 (en) Method and system for image border color selection
CN115689882A (en) Image processing method and device and computer readable storage medium
CN110544281B (en) Picture batch compression method, medium, mobile terminal and device
US10699391B2 (en) Dynamic range expansion highlight information restoration
CN108200433B (en) Image compression and decompression method
JPH06301773A (en) Method and device for color reduction picture processing
CN113379768A (en) Image processing method, image processing device, storage medium and computer equipment
US7468733B2 (en) Method and system for improving color reduction

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