WO2020042467A1 - 图片压缩方法、装置、设备及计算机可读存储介质 - Google Patents

图片压缩方法、装置、设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2020042467A1
WO2020042467A1 PCT/CN2018/122718 CN2018122718W WO2020042467A1 WO 2020042467 A1 WO2020042467 A1 WO 2020042467A1 CN 2018122718 W CN2018122718 W CN 2018122718W WO 2020042467 A1 WO2020042467 A1 WO 2020042467A1
Authority
WO
WIPO (PCT)
Prior art keywords
compressed
segmentation
picture
sub
compression
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2018/122718
Other languages
English (en)
French (fr)
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.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Publication of WO2020042467A1 publication Critical patent/WO2020042467A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Definitions

  • the present application relates to the technical field of picture processing, and in particular, to a picture compression method, device, device, and computer-readable storage medium.
  • the size of the APP itself is the focus of optimization for mobile developers, and the pictures in the APP occupy a large part of the resources.
  • the compression method for the large pictures in the APP is relatively simple, usually jpeg, png, webp or With single compression methods such as svg, the compression rate is limited.
  • the main purpose of this application is to provide a picture compression method, device, device, and computer-readable storage medium, which aim to solve the technical problem of low picture compression rate caused by a single picture compression method in the prior art.
  • the picture compression method includes:
  • the sub-graphs to be compressed are compressed.
  • the step of segmenting the compressed image according to a preset segmentation rule to obtain several sub-images to be compressed includes:
  • a segmentation line in the picture to be compressed is determined based on the segmentation instruction, and the segmentation line is adjusted according to a preset algorithm to divide the picture to be compressed into a plurality of sub-pictures to be compressed.
  • the segmentation line includes a segmentation horizontal line and a segmentation vertical line
  • the segmentation line in the picture to be compressed is determined based on the segmentation instruction, and the segmentation is performed according to a preset algorithm.
  • the steps of adjusting the line to divide the picture to be compressed into several sub-pictures to be compressed include:
  • ⁇ R C 1, R -C 2, R
  • ⁇ G C 1, G -C 2, G
  • C 1 and C 2 represent pixel colors 1 and 2;
  • C 1R and C 2R represent R channels of colors 1 and 2;
  • C 1G and C 2G represent G channels of colors 1 and 2;
  • C 1B and C 2B Represents the B channels of colors 1 and 2.
  • the method further includes:
  • the step of determining an optimal compression method corresponding to each of the sub-graphs to be compressed based on a preset compression rule includes:
  • a compression rule corresponding to the several sub-graphs to be compressed is determined based on the feature parameters, and an optimal compression method for the several sub-graphs to be compressed is determined according to the compression rules.
  • the optimal compression method includes a compression quality and a compression format
  • the step of compressing the sub-graphs to be compressed based on the optimal compression method includes:
  • a compression algorithm corresponding to the sub-pictures to be compressed is determined based on the compression quality and compression format, and the sub-pictures to be compressed are compressed based on the compression algorithm.
  • the method further includes:
  • the decompressed to-be-compressed sub-pictures are combined to obtain the to-be-compressed picture, and the combined to-be-compressed picture is displayed.
  • the present application further provides a picture compression device, where the picture compression device includes:
  • An image segmentation module configured to segment the compressed image according to a preset segmentation rule to obtain several sub-images to be compressed
  • a compression method determining module configured to determine an optimal compression method corresponding to each of the sub-graphs to be compressed based on a preset compression rule
  • a picture compression module is configured to compress the sub-pictures to be compressed based on the optimal compression method.
  • the present application also provides a picture compression device
  • the picture compression device includes: a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor, When the computer-readable instructions are executed by the processor, the steps of the picture compression method described above are implemented.
  • the present application also provides a computer-readable storage medium, where the computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the above-mentioned implementation is implemented. Steps of the image compression method.
  • a picture compression method proposed in the present application first divides a picture to be compressed based on a preset cut rule, divides it into several different sub-pictures to be compressed, and then determines several An optimal compression method for compressing a subgraph is compressed and compressed based on the optimal compression method.
  • the picture compression method proposed in the present application by segmenting the large picture to be compressed and adopting an optimal compression method for each sub-picture to be compressed, makes the total size of the compressed picture smaller than the large picture obtained by using a certain method alone.
  • the earth has improved the compression rate of pictures and reduced the size of the app.
  • FIG. 1 is a schematic diagram of a hardware structure of a picture compression device involved in a solution according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a first embodiment of a picture compression method according to the present application
  • step S10 in FIG. 2 is a detailed flowchart of step S10 in FIG. 2;
  • FIG. 4 is a schematic flowchart of a second embodiment of a picture compression method of the present application.
  • FIG. 5 is a schematic flowchart of a third embodiment of a picture compression method of the present application.
  • FIG. 6 is a schematic diagram of functional modules of a first embodiment of a picture compression device of the present application.
  • the main solution of the embodiment of the present application is: segmenting the compressed picture according to a preset segmentation rule to obtain a plurality of sub-images to be compressed; and based on the preset compression rule, determining the respective corresponding optimal sub-images.
  • Compression method Based on the optimal compression method, the plurality of sub-graphs to be compressed are compressed.
  • FIG. 1 is a schematic diagram of a hardware structure of a picture compression device involved in a solution of an embodiment of the present application.
  • the picture compression method according to the embodiment of the present application is mainly applied to a picture compression device, and the picture compression device may be a device with display and processing functions such as a PC, a portable computer, and a mobile terminal.
  • the picture compression device may include a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display, an input unit such as a keyboard, and the optional user interface 1003 may further include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory or a non-volatile memory (for example, a magnetic disk memory).
  • the memory 1005 may optionally be a storage device independent of the foregoing processor 1001.
  • FIG. 1 does not constitute a limitation on the picture compression device, and may include more or fewer parts than those shown in the figure, or combine some parts, or different parts. Layout.
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and computer-readable instructions.
  • the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server;
  • the user interface 1003 is mainly used to connect to the client (user) and perform data communication with the client; It may be provided in a picture compression device, which calls the computer-readable instructions stored in the memory 1005 through the processor 1001 and executes the picture compression method provided in the embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a first embodiment of a picture compression method of the present application.
  • the method includes:
  • Step S10 Segment the compressed image according to a preset segmentation rule to obtain several sub-images to be compressed
  • Step S20 Determine an optimal compression method corresponding to each of the sub-graphs to be compressed based on a preset compression rule
  • Step S30 Compress the sub-graphs to be compressed based on the optimal compression method.
  • this application proposes a picture compression method.
  • the compressed picture is segmented based on a preset segmentation rule. Divide it into several different sub-graphs to be compressed, and then determine the optimal compression method for several sub-graphs to be compressed according to preset compression rules, and compress them based on the optimal compression method to achieve higher Picture compression ratio.
  • the compressed image is first segmented according to a preset segmentation rule.
  • the preset segmentation rule may be based on a color change in the image to be compressed.
  • the step S10 includes :
  • Step S11 Obtain a color distribution of a picture to be compressed, and receive a segmentation instruction based on the color distribution;
  • Step S12 Determine a segmentation line in the picture to be compressed based on the segmentation instruction, and adjust the segmentation line according to a preset algorithm, so as to divide the picture to be compressed into several sub-compressors. Illustration.
  • the division is based on the color change in the picture to be compressed, that is, the color Block changes are divided, and the color block gap in the picture to be compressed is relatively large and divided into different blocks. For example, if there is a portrait in the picture to be compressed, and the other parts are scenery images, the color blocks of the portrait part and other scenery image parts change greatly, then by dividing the portrait and other scenery images, two or more to be compressed can be obtained. Submap.
  • a corresponding program can also be used to obtain the color distribution in the picture to be compressed, and based on the color distribution, different colors are located.
  • the blocks are divided to make a preliminary division of the compressed images.
  • the division of the blocks is further adjusted, and specifically, it is achieved by calculating the color distance.
  • the step S12 includes:
  • Step a determining a segmentation line in the picture to be compressed based on the segmentation instruction, and adjusting the segmentation horizontal line up and down and / or adjusting the segmentation vertical line left and right according to a preset algorithm,
  • the calculation formula of the preset algorithm is:
  • ⁇ R C 1, R -C 2, R
  • ⁇ G C 1, G -C 2, G
  • C 1 and C 2 represent pixel colors 1 and 2;
  • C 1R and C 2R represent R channels of colors 1 and 2;
  • C 1G and C 2G represent G channels of colors 1 and 2;
  • C 1B and C 2B Represents the B channels of colors 1 and 2.
  • the segmentation line for segmenting the compressed image includes a segmentation horizontal line and a segmentation vertical line.
  • the manner of segmenting the compressed picture is segmented by horizontal or vertical lines, so each block obtained after segmentation is a regular square block.
  • the divided horizontal or vertical lines are adjusted based on a preset algorithm, so that the division of the blocks is more accurate.
  • the specific ways to adjust the split horizontal or vertical lines are as follows:
  • the color distance refers to the difference between two colors. Generally, the larger the color distance, the greater the difference between the two colors; otherwise, the closer the two colors are.
  • the division line can be adjusted to make the block division more accurate. Specifically, when calculating the color distance, the color distance is calculated by using a similar formula to calculate the Euclidean distance between two points. In RGB space, the calculation formula for color distance is:
  • C 1 and C 2 represent colors 1 and 2
  • C 1R and C 2R represent R channels of colors 1 and 2
  • C 1G and C 2G represent G channels of colors 1 and 2
  • C 1B and C 2B represent colors 1 And 2 B channels.
  • ⁇ R C 1, R -C 2, R
  • ⁇ G C 1, G -C 2, G
  • C 1 and C 2 represent pixel colors 1 and 2
  • C 1R and C 2R represent R channels of colors 1 and 2
  • C 1G and C 2G represent G channels of colors 1 and 2
  • C 1B and C 2B represent Channels 1 and 2 of color B.
  • the color distance of the vertical lines in the center of the two sub-graphs is the sum of the color distances of the corresponding pixels.
  • the division line with the smallest color distance from the vertical line of the center of the left or right sub-graph can be determined as Finally, the segmentation line for compressing the compressed image. Similarly, similar processing is performed on the transverse tangent line to obtain the final segmentation line, and then the sub-graph to be compressed after segmentation is obtained.
  • the image to be compressed is segmented according to the color block changes in the image to be compressed to obtain several sub-images to be compressed, and then a preset compression rule is obtained, and one is determined for each sub-image to be compressed based on the preset compression rule.
  • An optimal compression method, and based on the optimal compression method, each sub-graph to be compressed is compressed, so as to improve the compression rate of the sub-graphs to be compressed.
  • the picture to be compressed is segmented based on a preset segmentation rule, and then divided into several different sub-images to be compressed, and then the Optimal compression method, and compress it based on the optimal compression method.
  • the picture compression method proposed in the present application by segmenting the large picture to be compressed and adopting an optimal compression method for each sub-picture to be compressed, makes the total size of the compressed picture smaller than the large picture obtained by using a certain method alone.
  • the earth has improved the compression rate of pictures and reduced the size of the app.
  • the step S20 includes:
  • Step S21 Obtain a preset compression rule and characteristic parameters of the sub-graphs to be compressed
  • Step S22 Determine a compression rule corresponding to the sub-graphs to be compressed based on the feature parameters and the preset compression rule, and determine an optimal compression method for the sub-graphs to be compressed according to the compression rule. .
  • the method is as follows: First, obtain the characteristic parameters of the sub-picture to be compressed, where the characteristic parameters may include: image size, whether it contains transparency and the number of image colors, etc.
  • the picture size refers to the total number of pixels included in the sub-picture to be compressed after segmentation.
  • whether it contains transparency refers to whether the number of image colors of the sub-picture to be compressed is less than a certain number; if so, it is considered that the sub-picture to be compressed contains transparency; the number of image colors refers to The number of colors included is related to the number of bits used to describe the color.
  • the compression rules corresponding to several subgraphs to be compressed can be determined based on the corresponding preset compression rules. Based on the compression rule, the optimal compression method for each subgraph to be compressed can be determined. , Including compression quality and compression format. Specifically, different compression rules can be set for different types of sub-pictures to be compressed.
  • the compression rule corresponding to the sub-picture to be compressed can be determined as the first compression rule, and so on, and compression rules under different picture sizes, transparency parameters, and color parameters can be set.
  • the following table shows a preset compression rule in this embodiment:
  • the foregoing preset compression rules are not complete, and can be added and adjusted according to actual needs.
  • the optimal compression method corresponding to the sub-graph to be compressed can be determined in order to compress it.
  • the step of compressing the sub-graphs to be compressed based on the optimal compression method includes:
  • Step b Determine a compression algorithm corresponding to the sub-pictures to be compressed based on the compression quality and compression format, and compress the sub-pictures to be compressed based on the compression algorithm.
  • an optimal compression method corresponding to several sub-graphs to be compressed can be determined, including compression quality and compression format, etc., and corresponding sub-graphs to be compressed can be determined according to the determined compression quality and compression format.
  • Graph compression processing algorithm Specifically, the correspondence between the compression quality, compression format, and compression processing algorithm can be set in advance, where the compression processing algorithm can be a preset logic rule, or an existing tool that utilizes the above compression processing algorithm can be called to the picture Perform compression processing. It can be understood that a decision tree algorithm can also be used to determine the optimal compression method for the subgraphs to be compressed. After determining the optimal compression method for the sub-pictures to be compressed, compression processing is performed on each sub-picture to be compressed, which improves the compression ratio of the picture.
  • the optimal compression method includes a compression quality and a compression format, further determines a compression algorithm for the subgraph to be compressed based on the compression quality and the compression format, and finally compresses the corresponding subgraph to be compressed according to the compression algorithm.
  • step S30 the method further includes:
  • Step S40 Save the compressed sub-picture to be compressed, and when a display instruction based on the picture to be compressed is detected, decompress the compressed sub-picture to be compressed;
  • Step S50 Based on the recorded position information, combine the decompressed sub-pictures to be compressed to obtain the picture to be compressed, and display the combined picture to be compressed.
  • the compressed sub-pictures are saved.
  • the compressed sub-pictures are compressed. Decompress and combine.
  • the combined method is to combine the compressed sub-pictures according to the arrangement position before segmentation of the sub-pictures to be compressed, and stitch them into a complete picture to complete the decompression and display of the pictures to be compressed.
  • the method further includes:
  • Step c Record position information of the sub-pictures to be compressed in the picture to be compressed.
  • the segmented to-compressed sub-images should be labeled. Specifically, it is Refers to the position mark of the sub-picture to be compressed in the original picture to be compressed. For example, the position parameter information of the sliced to-be-compressed sub-picture may be saved to determine the position of the to-be-compressed sub-picture in the picture to be compressed.
  • the data description files are mainly the file names of the sub-pictures to be compressed. , Left top coordinate and width and height. Among them, the left top coordinate and width and height describe the position information of the sub-picture to be compressed in the original large picture to be compressed.
  • each compressed sub-image will be decompressed to obtain the sub-image to be compressed again, and then the decompressed image will be decompressed according to the left top coordinate and width and height in the data description file.
  • a picture to be compressed is segmented based on a preset segmentation rule, and is divided into several different sub-images to be compressed, and several sub-images to be compressed are recorded in the original large image to be compressed.
  • Position information so that when it is necessary to display the large image to be compressed, the decompressed sub-images to be compressed are re-spliced according to the recorded position information to obtain the image to be compressed, and the combined image to be compressed is displayed, reducing APP The size improves the user experience.
  • an embodiment of the present application further provides a picture compression device.
  • FIG. 6 is a schematic diagram of functional modules of a first embodiment of a picture compression apparatus of the present application.
  • the picture compression device includes:
  • An image segmentation module configured to segment the compressed image according to a preset segmentation rule to obtain several sub-images to be compressed
  • a compression method determining module configured to determine an optimal compression method corresponding to each of the sub-graphs to be compressed based on a preset compression rule
  • a picture compression module is configured to compress the sub-pictures to be compressed based on the optimal compression method.
  • the picture segmentation module 10 specifically includes:
  • a picture segmentation unit configured to obtain a color distribution of a picture to be compressed, and receive a segmentation instruction based on the color distribution;
  • a segmentation adjustment unit is configured to determine a segmentation line in the picture to be compressed based on the segmentation instruction, and adjust the segmentation line according to a preset algorithm to divide the picture to be compressed into several Subgraphs to be compressed.
  • segmentation adjustment unit specifically includes:
  • a slicing line adjustment subunit is configured to determine a slicing line in the picture to be compressed based on the slicing instruction, and adjust the slicing horizontal line up and down and / or the slicing according to a preset algorithm.
  • the vertical line is adjusted left and right, so that the picture to be compressed is divided into several sub-pictures to be compressed based on the sliced horizontal line and / or the sliced vertical line, wherein the calculation formula of the preset algorithm is :
  • ⁇ R C 1, R -C 2, R
  • ⁇ G C 1, G -C 2, G
  • C 1 and C 2 represent pixel colors 1 and 2;
  • C 1R and C 2R represent R channels of colors 1 and 2;
  • C 1G and C 2G represent G channels of colors 1 and 2;
  • C 1B and C 2B Represents the B channels of colors 1 and 2.
  • the picture compression device further includes:
  • the position recording unit is configured to record position information of the sub-pictures to be compressed in the picture to be compressed.
  • the compression method determining module 20 specifically includes:
  • a parameter obtaining unit configured to obtain a preset compression rule and characteristic parameters of the sub-graphs to be compressed
  • the compression method determining unit is configured to determine a compression rule corresponding to the several sub-graphs to be compressed based on the feature parameter and the preset compression rule, and determine the sub-graphs to be compressed respectively according to the compression rule.
  • Optimal compression method is configured to determine a compression rule corresponding to the several sub-graphs to be compressed based on the feature parameter and the preset compression rule, and determine the sub-graphs to be compressed respectively according to the compression rule.
  • picture compression module 30 specifically includes:
  • a compression algorithm determining unit is configured to determine a compression algorithm corresponding to the sub-pictures to be compressed based on the compression quality and compression format, and compress the sub-pictures to be compressed based on the compression algorithm.
  • the picture compression device further includes:
  • a sub-graphic compression unit configured to save the compressed sub-picture to be compressed, and when a display instruction based on the picture to be compressed is detected, decompress the compressed sub-picture to be compressed;
  • a sub-picture combining unit configured to combine the decompressed to-be-compressed sub-pictures to obtain the to-be-compressed picture based on the recorded position information, and display the combined to-be-compressed picture.
  • Each module in the picture compression apparatus corresponds to each step in the embodiment of the picture compression method, and functions and implementation processes thereof are not described here one by one.
  • an embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium may be a non-volatile readable storage medium.
  • Computer-readable instructions are stored on the computer-readable storage medium of the present application, and when the computer-readable instructions are executed by a processor, the steps of the picture compression method described above are implemented.
  • the methods in the above embodiments can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware, but in many cases the former is better.
  • Implementation Based on such an understanding, the technical solution of this application that is essentially or contributes to the existing technology can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium (such as ROM / RAM) as described above. , Magnetic disk, optical disc), including a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in the embodiments of the present application.

Landscapes

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

Abstract

一种图片压缩方法、图片压缩装置、设备及计算机可读存储介质,涉及人工智能技术领域,该方法包括:根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图(S10);基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法(S20);基于所述最优压缩方法,对所述若干个待压缩子图进行压缩(S30)。该方法提升了图片的压缩率。

Description

图片压缩方法、装置、设备及计算机可读存储介质
本申请要求于2018年8月31日提交中国专利局、申请号为201811016766.3、发明名称为“图片压缩方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及图片处理技术领域,尤其涉及一种图片压缩方法、装置、设备及计算机可读存储介质。
背景技术
众所周知,APP本身的大小是移动开发者们优化的重点,而APP中图片就占据了很大一部分资源,目前对于APP中的大图采用的压缩方式比较单一,通常是采用jpeg、png、webp或svg等单一压缩方式,压缩率提升有限。
发明内容
本申请的主要目的在于提供一种图片压缩方法、装置、设备及计算机可读存储介质,旨在解决现有技术中图片压缩方式单一导致的图片压缩率低的技术问题。
为实现上述目的,本申请提供一种图片压缩方法,所述图片压缩方法包括:
根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;
基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
可选地,所述根据预设切分规则对待压缩图片进行切分,得到若 干个待压缩子图的步骤包括:
获取待压缩图片的颜色分布,并接收基于所述颜色分布的切分指令;
基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图。
可选地,所述切分线包括切分横线以及切分竖线,所述基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图的步骤包括:
基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分横线进行上下调整和/或对所述切分竖线进行左右调整,以便基于所述切分横线和/或所述切分竖线将所述待压缩图片切分为若干个待压缩子图,其中,所述预设算法的计算公式为:
Figure PCTCN2018122718-appb-000001
ΔR=C 1,R-C 2,R
ΔG=C 1,G-C 2,G
ΔB=C 1,B-C 2,B
Figure PCTCN2018122718-appb-000002
其中,所述C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
可选地,所述根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图的步骤之后,还包括:
记录所述若干个待压缩子图在所述待压缩图片中的位置信息。
可选地,所述基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法的步骤包括:
获取预设压缩规则及所述若干个待压缩子图的特征参数;
基于所述特征参数确定所述若干个待压缩子图对应的压缩规则,并根据所述压缩规则分别确定所述若干个待压缩子图的最优压缩方法。
可选地,所述最优压缩方法包括压缩质量和压缩格式,所述基于所述最优压缩方法,对所述若干个待压缩子图进行压缩的步骤包括:
基于所述压缩质量和压缩格式确定所述若干个待压缩子图对应的压缩算法,并基于所述压缩算法对所述待压缩子图进行压缩。
可选地,所述基于所述最优压缩方法,对所述若干个待压缩子图进行压缩的步骤之后,还包括:
保存所述压缩后的待压缩子图,并在检测到基于所述待压缩图片的展示指令时,对所述压缩后的待压缩子图进行解压;
基于所述记录的位置信息,对所述解压后的待压缩子图进行组合得到所述待压缩图片,并对所述组合后的待压缩图片进行展示。
此外,为实现上述目的,本申请还提供一种图片压缩装置,所述图片压缩装置包括:
图片切分模块,用于根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
压缩方法确定模块,用于基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;
图片压缩模块,用于基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
此外,为实现上述目的,本申请还提供一种图片压缩设备,所述图片压缩设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述计算机可读指令被所述处理器执行时实现如上所述的图片压缩方法的步骤。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机可读指令,所述计算机可读 指令被处理器执行时实现如上所述的图片压缩方法的步骤。
本申请提出的一种图片压缩方法,首先基于预设切分规则对待压缩的图片进行切分,将其切分为几个不同的待压缩子图,再根据预设压缩规则分别确定若干个待压缩子图对应的最优压缩方法,并基于该最优压缩方法对其进行压缩。本申请提出的图片压缩方法,通过切分待压缩大图并对每一个待压缩子图采取最优压缩方法,使得压缩后的图片大小总和小于单独采用某一种方式压缩得到的大图,极大地提高了图片的压缩率,减少了APP大小。
附图说明
图1为本申请实施例方案中涉及的图片压缩设备的硬件结构示意图;
图2为本申请图片压缩方法第一实施例的流程示意图;
图3为图2中的步骤S10的细化流程示意图;
图4为本申请图片压缩方法第二实施例的流程示意图;
图5为本申请图片压缩方法第三实施例的流程示意图;
图6为本申请图片压缩装置第一实施例的功能模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例的主要解决方案是:根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。通过本申请实施例的技术方案,解决了现有技术中图片压缩方式单一导致的图片压缩率低的技术问 题。
如图1所示,图1为本申请实施例方案中涉及的图片压缩设备的硬件结构示意图。
本申请实施例涉及的图片压缩方法主要应用于图片压缩设备,该图片压缩设备可以是PC、便携计算机、移动终端等具有显示和处理功能的设备。
如图1所示,该图片压缩设备可以包括:处理器1001,例如CPU,通信总线1002,用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
本领域技术人员可以理解,图1中示出的图片压缩设备结构并不构成对图片压缩设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及计算机可读指令。在图1中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001、存储器1005可以设置在图片压缩装置中,所述图片压缩装置通过处理器1001调用存储器1005中存储的计算机可读指令,并执行本申请实施例提供的图片压缩方法。
基于上述硬件结构,提出本申请图片压缩方法实施例。
参照图2,图2为本申请图片压缩方法第一实施例的流程示意图,在该实施例中,所述方法包括:
步骤S10,根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
步骤S20,基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;
步骤S30,基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
为了解决图片压缩方式单一导致的图片压缩率低的问题,提高图片压缩率以减少APP的大小,本申请提出了一种图片压缩方法,首先基于预设切分规则对待压缩的图片进行切分,将其切分为几个不同的待压缩子图,再根据预设压缩规则分别确定若干个待压缩子图的最优压缩方法,并基于该最优压缩方法对其进行压缩,以实现更高的图片压缩率。
在本实施例中,首先根据预设切分规则对待压缩图片进行切分,具体地,预设切分规则可以是基于待压缩图片中的颜色变化,如图3所示,所述步骤S10包括:
步骤S11,获取待压缩图片的颜色分布,并接收基于所述颜色分布的切分指令;
步骤S12,基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图。
具体地,在本实施例中,通过获取待压缩图片中的颜色分布,并首先基于人工将其大致划分为几个不同的区块,划分的依据是按照待压缩图片中的颜色变化,即色块变化进行划分,将待压缩图片中色块差距比较大的切分为不同的区块。例如,待压缩图片中有一个人像,其他部分是景色图像,人像部分与其他景色图像部分的色块变化较大,则通过将人像与其他景色图像划分,即可得到两个或多个待压缩子图。
可以理解的是,除了上述所说的通过人工首先对待压缩图片进行一个大致的划分之外,还可以通过相应的程序,获取待压缩图片中的颜色分布,并基于颜色分布对不同的颜色所在的区块进行划分,以对待压缩图片进行初步划分。
进一步地,基于待压缩图片中的颜色分布,对待压缩图片进行初步划分后,再对区块的划分做进一步的调整,具体地,是通过计算颜色距离来实现的。
具体地,所述步骤S12包括:
步骤a,基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分横线进行上下调整和/或对所述切分竖线进行左右调整,以便基于所述切分横线和/或所述切分竖线将所述待压缩图片切分为若干个待压缩子图,其中,所述预设算法的计算公式为:
Figure PCTCN2018122718-appb-000003
ΔR=C 1,R-C 2,R
ΔG=C 1,G-C 2,G
ΔB=C 1,B-C 2,B
Figure PCTCN2018122718-appb-000004
其中,所述C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
具体地,对待压缩图片进行切分的切分线包括切分横线以及切分竖线,通过对待压缩图片进行大致的区块划分,将其划分为几个包含不同色块的区块,通过设定切分线的初始值,可以极大地提高后续对切分线进行调整的效率。可以理解的是,对待压缩图片进行切分的方式是以横线或竖线方式切分,因此,切分后得到的各个区块均是规则的方形区块。进一步地,再基于预设的算法对切分的横线或竖线进行调整,使得对区块的划分更加准确。对切分的横线或竖线进行调整的具体方式如下:
颜色距离指的是两个颜色之间的差距,通常颜色距离越大,表明两个颜色相差越大;反之,两个颜色越相近。通过对切分的横线或竖线的上下或左右的颜色距离进行计算,即可对切分线进行调整,使区块切分更加准确。具体地,在计算颜色距离时,通过使用类似计算两 点间欧式距离的公式一样,对颜色距离进行计算。在RGB空间中,颜色距离的计算公式为:
Figure PCTCN2018122718-appb-000005
其中,C 1和C 2表示颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
但是,由于RGB空间是线性的并且相互正交,但是人眼的视觉系统并不是线性的,因此RGB空间并不能反映人眼对颜色的感知,所以,相对应的颜色距离也不能很好的反映两个颜色是否相近。基于上述问题,使用了改进后的加权欧式距离,具体计算方式如下:
Figure PCTCN2018122718-appb-000006
ΔR=C 1,R-C 2,R
ΔG=C 1,G-C 2,G
ΔB=C 1,B-C 2,B
Figure PCTCN2018122718-appb-000007
同样地,C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。通过上述改进后的加权欧式距离计算方法,即可计算出两个颜色之间的差距。在本实施例中,基于切分线两侧的颜色距离,即可对切分线进行调整及确定。
为了便于理解,具体举例说明如下:以原始的基于颜色分布确定的切分线为中心,如果切分线是竖切线,则将竖切分线左右各移动n个像素,此处的移动步长为1个像素,则可得到2*n根竖切线。同时获取原始竖切分线左侧和右侧子图的中心竖线,并分别计算这2*n根竖切线与这两根子图中心竖线的距离,单个像素的颜色距离是通过使用改进后的加权欧氏距离公式进行计算,两根子图中心竖线的颜色距离则是各对应像素的颜色距离总和,距离左或右子图中心竖线颜色距离最小的的切分线,即可确定为最终对待压缩图片进行切分的分割线。 同样地,对横切线也做类似的处理,就可以得到最终的分割线,进而得到分割后的待压缩子图。
进一步地,根据待压缩图片中的色块变化对待压缩图片进行切分,以得到若干个待压缩子图后,再获取预设压缩规则,基于预设压缩规则为每一个待压缩子图确定一个最优压缩方法,并基于该最优压缩方法对每一个待压缩子图进行压缩,以实现待压缩子图压缩率的提升。
在本实施例中,首先基于预设切分规则对待压缩的图片进行切分,将其切分为几个不同的待压缩子图,再根据预设压缩规则分别确定若干个待压缩子图的最优压缩方法,并基于该最优压缩方法对其进行压缩。本申请提出的图片压缩方法,通过切分待压缩大图并对每一个待压缩子图采取最优压缩方法,使得压缩后的图片大小总和小于单独采用某一种方式压缩得到的大图,极大地提高了图片的压缩率,减少了APP大小。
进一步的,参照图4,基于上述实施例,提出本申请图片压缩方法第二实施例,在本实施例中,所述步骤S20包括:
步骤S21,获取预设压缩规则及所述若干个待压缩子图的特征参数;
步骤S22,基于所述特征参数和所述预设压缩规则确定所述若干个待压缩子图对应的压缩规则,并根据所述压缩规则分别确定所述若干个待压缩子图的最优压缩方法。
根据待压缩图片中的色块变化对待压缩图片进行切分,以得到若干个待压缩子图后,再基于预设压缩规则,对每一个待压缩子图采取最合适的压缩方法进行压缩,具体方法如下:首先获取待压缩子图的特征参数,其中,特征参数可以包括:图片大小、是否包含透明以及图像颜色数等,图片大小是指切分后的待压缩子图所包含的总像素数,用宽度方向像素与高度方向像素的乘积表示;是否包含透明是指待压缩子图的图像颜色数是否小于一定数值,若是,即视为待压缩子图包含透明;图像颜色数是指图像中所包含的颜色的多少,与描述颜色所使用的位数有关。
可以理解的是,除了上述所列举的待压缩子图的特征参数之外,还可以包括其他的特征参数,在此并不一一列举。
根据待压缩子图的上述特征参数,基于相应的预设压缩规则即可确定若干个待压缩子图分别对应的压缩规则,基于该压缩规则就可以确定每一个待压缩子图的最优压缩方法,包括压缩质量和压缩格式。具体地,可以针对不同的待压缩子图的类型设置不同的压缩规则,例如,若待压缩子图的图片大小小于第一预设阈值,且待压缩子图中含有透明且图片颜色数小于第一预设颜色数时,即可确定该待压缩子图对应的压缩规则为第一压缩规则,以此类推,可以设置不同图片大小、透明参数以及颜色参数下的压缩规则。如下表所示,为本实施例中一预设压缩规则:
图片大小 是否包含透明 图片颜色数 压缩质量 压缩格式
<2k 可以含透明 <=4 100% SVG
>20k 不含透明 >=256 70% JPEG
>20K 可以含透明 >=512 70% WEBP
可以理解的是,上述预设压缩规则并不完整,可根据实际需要进行增加及调整。基于上述预设压缩规则,根据获取的待压缩子图相应的特征参数,即可确定该待压缩子图所对应的最优压缩方法,以便对其进行压缩。
进一步地,所述基于所述最优压缩方法,对所述若干个待压缩子图进行压缩的步骤包括:
步骤b,基于所述压缩质量和压缩格式确定所述若干个待压缩子图对应的压缩算法,并基于所述压缩算法对所述待压缩子图进行压缩。
进一步地,基于相应的预设压缩规则,可以确定若干个待压缩子图分别对应的最优压缩方法,包括压缩质量和压缩格式等,根据确定的压缩质量和压缩格式可以确定对应的待压缩子图的压缩处理算法。具体地,可以预先设置压缩质量、压缩格式与压缩处理算法之间的对应关系,其中,压缩处理算法可以是预设的逻辑规则,也可以调用现有的利用上述压缩处理算法的工具来对图片进行压缩处理。可以理解的是,还可以采用决策树算法来决定待压缩子图的最佳压缩方法。确 定待压缩子图的最佳压缩方法后,对各个待压缩子图进行压缩处理,提高了图片的压缩率。
在本实施例中,对待压缩图片进行切分得到若干待压缩子图后,获取待压缩子图的特征参数,并根据待压缩子图的特征参数,基于预设压缩规则确定其对应的最优压缩方法,其中,最优压缩方法包括压缩质量和压缩格式,进一步基于压缩质量和压缩格式确定待压缩子图的压缩算法,最后根据该压缩算法对对应的待压缩子图进行压缩。通过为每一个待压缩子图采取最优压缩方法,减少了图片压缩后所占的内存,提高了图片压缩率。
进一步的,参照图5,基于上述实施例,提出本申请图片压缩方法第三实施例,在本实施例中,所述步骤S30之后还包括:
步骤S40,保存所述压缩后的待压缩子图,并在检测到基于所述待压缩图片的展示指令时,对所述压缩后的待压缩子图进行解压;
步骤S50,基于所述记录的位置信息,对所述解压后的待压缩子图进行组合得到所述待压缩图片,并对所述组合后的待压缩图片进行展示。
在本实施例中,当采取最优压缩方法分别对每一个待压缩子图进行压缩后,将压缩后的子图进行保存,当需要展示大图时,通过对各个压缩后的待压缩子图进行解压并组合,组合的方式是按照待压缩子图切分前的排列位置对压缩后的子图进行组合,以拼接成一幅完整的图片,即可完成对待压缩图片的解压及展示。
具体地,所述步骤S10之后,还包括:
步骤c,记录所述若干个待压缩子图在所述待压缩图片中的位置信息。
具体地,对待压缩图片进行切分以得到若干个待压缩子图后,为了便于后续对压缩后的子图进行组合,应当对切分得到的若干个待压缩子图进行标记,具体地,是指待压缩子图在原来的待压缩图片中的位置标记。例如,可以通过保存切分后的待压缩子图的位置参数信息,以确定该待压缩子图在待压缩图片中的位置。
进一步地,待压缩子图在基于最优压缩方法压缩完成后,会生成一系列待压缩子图压缩后的图片格式文件,以及数据描述文件,数据描述文件主要是各待压缩子图的文件名、左顶坐标和宽高,其中,左顶坐标和宽高即描述的是待压缩子图在原有的待压缩大图中的位置信息。当检测到基于该待压缩大图的展示信息时,会将各个压缩后的子图进行解压,重新得到待压缩子图,再根据数据描述文件中的左顶坐标和宽高,对解压后的各待压缩子图进行组合,即可重新拼接得到原始的待压缩大图,并将待压缩大图展示出来。
在本实施例中,基于预设切分规则对待压缩的图片进行切分,将其切分为几个不同的待压缩子图,并记录若干个待压缩子图在原始的待压缩大图中的位置信息,以便当需要展示待压缩大图时,对解压后的待压缩子图按照记录的位置信息进行重新拼接,得到待压缩图片,并对组合后的待压缩图片进行展示,减少了APP的大小,提升了用户的使用体验。
此外,本申请实施例还提供一种图片压缩装置。
参照图6,图6为本申请图片压缩装置第一实施例的功能模块示意图。
本实施例中,所述图片压缩装置包括:
图片切分模块,用于根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
压缩方法确定模块,用于基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;
图片压缩模块,用于基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
进一步的,所述图片切分模块10具体包括:
图片切分单元,用于获取待压缩图片的颜色分布,并接收基于所述颜色分布的切分指令;
切分调整单元,用于基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩 图片切分为若干个待压缩子图。
进一步地,所述切分调整单元具体包括:
切分线调整子单元,用于基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分横线进行上下调整和/或对所述切分竖线进行左右调整,以便基于所述切分横线和/或所述切分竖线将所述待压缩图片切分为若干个待压缩子图,其中,所述预设算法的计算公式为:
Figure PCTCN2018122718-appb-000008
ΔR=C 1,R-C 2,R
ΔG=C 1,G-C 2,G
ΔB=C 1,B-C 2,B
Figure PCTCN2018122718-appb-000009
其中,所述C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
进一步地,所述图片压缩装置还包括:
位置记录单元,用于记录所述若干个待压缩子图在所述待压缩图片中的位置信息。
进一步地,所述压缩方法确定模块20具体包括:
参数获取单元,用于获取预设压缩规则及所述若干个待压缩子图的特征参数;
压缩方法确定单元,用于基于所述特征参数和所述预设压缩规则确定所述若干个待压缩子图对应的压缩规则,并根据所述压缩规则分别确定所述若干个待压缩子图的最优压缩方法。
进一步地,所述图片压缩模块30具体包括:
压缩算法确定单元,用于基于所述压缩质量和压缩格式确定所述若干个待压缩子图对应的压缩算法,并基于所述压缩算法对所述待压缩子图进行压缩。
进一步地,所述图片压缩装置还包括:
子图解压单元,用于保存所述压缩后的待压缩子图,并在检测到基于所述待压缩图片的展示指令时,对所述压缩后的待压缩子图进行解压;
子图组合单元,用于基于所述记录的位置信息,对所述解压后的待压缩子图进行组合得到所述待压缩图片,并对所述组合后的待压缩图片进行展示。
其中,上述图片压缩装置中各个模块与上述图片压缩方法实施例中各步骤相对应,其功能和实现过程在此处不再一一赘述。
此外,本申请实施例还提出一种计算机可读存储介质,,所述计算机可读存储介质可以为非易失性可读存储介质。
本申请计算机可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如上所述的图片压缩方法的步骤。
其中,计算机可读指令被执行时所实现的方法可参照本申请图片压缩方法的各个实施例,此处不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所 述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (19)

  1. 一种图片压缩方法,其特征在于,所述图片压缩方法包括以下步骤:
    根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
    基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;
    基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
  2. 如权利要求1所述的图片压缩方法,其特征在于,所述根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图的步骤包括:
    获取待压缩图片的颜色分布,并接收基于所述颜色分布的切分指令;
    基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图。
  3. 如权利要求2所述的图片压缩方法,其特征在于,所述切分线包括切分横线以及切分竖线,所述基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图的步骤包括:
    基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分横线进行上下调整和/或对所述切分竖线进行左右调整,以便基于所述切分横线和/或所述切分竖线将所述待压缩图片切分为若干个待压缩子图,其中,所述预设算法的计算公式为:
    Figure PCTCN2018122718-appb-100001
    ΔR=C 1,R-C 2,R
    ΔG=C 1,G-C 2,G
    ΔB=C 1,B-C 2,B
    Figure PCTCN2018122718-appb-100002
    其中,所述C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
  4. 如权利要求3所述的图片压缩方法,其特征在于,所述根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图的步骤之后,还包括:
    记录所述若干个待压缩子图在所述待压缩图片中的位置信息。
  5. 如权利要求4所述的图片压缩方法,其特征在于,所述基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法的步骤包括:
    获取预设压缩规则及所述若干个待压缩子图的特征参数;
    基于所述特征参数和所述预设压缩规则确定所述若干个待压缩子图对应的压缩规则,并根据所述压缩规则分别确定所述若干个待压缩子图的最优压缩方法。
  6. 如权利要求5所述的图片压缩方法,其特征在于,所述最优压缩方法包括压缩质量和压缩格式,所述基于所述最优压缩方法,对所述若干个待压缩子图进行压缩的步骤包括:
    基于所述压缩质量和压缩格式确定所述若干个待压缩子图对应的压缩算法,并基于所述压缩算法对所述待压缩子图进行压缩。
  7. 如权利要求6所述的图片压缩方法,其特征在于,所述基于所述最优压缩方法,对所述若干个待压缩子图进行压缩的步骤之后,还包括:
    保存所述压缩后的待压缩子图,并在检测到基于所述待压缩图片的展示指令时,对所述压缩后的待压缩子图进行解压;
    基于所述记录的位置信息,对所述解压后的待压缩子图进行组合得到所述待压缩图片,并对所述组合后的待压缩图片进行展示。
  8. 一种图片压缩装置,其特征在于,所述图片压缩装置包括:
    图片切分模块,用于根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
    压缩方法确定模块,用于基于预设压缩规则确定所述若干个待压 缩子图分别对应的最优压缩方法;
    图片压缩模块,用于基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
  9. 如权利要求8所述的图片压缩装置,其特征在于,所述图片切分模块包括:
    图片切分单元,用于获取待压缩图片的颜色分布,并接收基于所述颜色分布的切分指令;
    切分调整单元,用于基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图。
  10. 如权利要求9所述的图片压缩装置,其特征在于,所述切分调整单元包括:
    切分线调整子单元,用于基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分横线进行上下调整和/或对所述切分竖线进行左右调整,以便基于所述切分横线和/或所述切分竖线将所述待压缩图片切分为若干个待压缩子图,其中,所述预设算法的计算公式为:
    Figure PCTCN2018122718-appb-100003
    ΔR=C 1,R-C 2,R
    ΔG=C 1,G-C 2,G
    ΔB=C 1,B-C 2,B
    Figure PCTCN2018122718-appb-100004
    其中,所述C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
  11. 如权利要求10所述的图片压缩装置,其特征在于,所述压缩方法确定模块包括:
    参数获取单元,用于获取预设压缩规则及所述若干个待压缩子图 的特征参数;
    压缩方法确定单元,用于基于所述特征参数和所述预设压缩规则确定所述若干个待压缩子图对应的压缩规则,并根据所述压缩规则分别确定所述若干个待压缩子图的最优压缩方法。
  12. 一种图片压缩设备,其特征在于,所述图片压缩设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述计算机可读指令被所述处理器执行时实现如下步骤:
    根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
    基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;
    基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
  13. 如权利要求12所述的图片压缩设备,其特征在于,所述根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图的步骤包括:
    获取待压缩图片的颜色分布,并接收基于所述颜色分布的切分指令;
    基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图。
  14. 如权利要求13所述的图片压缩设备,其特征在于,所述切分线包括切分横线以及切分竖线,所述基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图的步骤包括:
    基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分横线进行上下调整和/或对所述切分竖线进行左右调整,以便基于所述切分横线和/或所述切分竖线将所述待压缩图片切分为若干个待压缩子图,其中,所述预设算法的计算公式为:
    Figure PCTCN2018122718-appb-100005
    ΔR=C 1,R-C 2,R
    ΔG=C 1,G-C 2,G
    ΔB=C 1,B-C 2,B
    Figure PCTCN2018122718-appb-100006
    其中,所述C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
  15. 如权利要求14所述的图片压缩设备,其特征在于,所述基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法的步骤包括:
    获取预设压缩规则及所述若干个待压缩子图的特征参数;
    基于所述特征参数和所述预设压缩规则确定所述若干个待压缩子图对应的压缩规则,并根据所述压缩规则分别确定所述若干个待压缩子图的最优压缩方法。
  16. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如下步骤:
    根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图;
    基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法;
    基于所述最优压缩方法,对所述若干个待压缩子图进行压缩。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述根据预设切分规则对待压缩图片进行切分,得到若干个待压缩子图的步骤包括:
    获取待压缩图片的颜色分布,并接收基于所述颜色分布的切分指令;
    基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待 压缩子图。
  18. 如权利要求17所述的计算机可读存储介质,其特征在于,所述切分线包括切分横线以及切分竖线,所述基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分线进行调整,以便将所述待压缩图片切分为若干个待压缩子图的步骤包括:
    基于所述切分指令确定所述待压缩图片中的切分线,并根据预设算法对所述切分横线进行上下调整和/或对所述切分竖线进行左右调整,以便基于所述切分横线和/或所述切分竖线将所述待压缩图片切分为若干个待压缩子图,其中,所述预设算法的计算公式为:
    Figure PCTCN2018122718-appb-100007
    ΔR=C 1,R-C 2,R
    ΔG=C 1,G-C 2,G
    ΔB=C 1,B-C 2,B
    Figure PCTCN2018122718-appb-100008
    其中,所述C 1和C 2表示像素颜色1和颜色2,C 1R、C 2R表示颜色1和2的R通道,C 1G、C 2G表示颜色1和2的G通道,C 1B、C 2B表示颜色1和2的B通道。
  19. 如权利要求18所述的计算机可读存储介质,其特征在于,所述基于预设压缩规则确定所述若干个待压缩子图分别对应的最优压缩方法的步骤包括:
    获取预设压缩规则及所述若干个待压缩子图的特征参数;
    基于所述特征参数和所述预设压缩规则确定所述若干个待压缩子图对应的压缩规则,并根据所述压缩规则分别确定所述若干个待压缩子图的最优压缩方法。
PCT/CN2018/122718 2018-08-31 2018-12-21 图片压缩方法、装置、设备及计算机可读存储介质 Ceased WO2020042467A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811016766.3A CN109685861B (zh) 2018-08-31 2018-08-31 图片压缩方法、装置、设备及计算机可读存储介质
CN201811016766.3 2018-08-31

Publications (1)

Publication Number Publication Date
WO2020042467A1 true WO2020042467A1 (zh) 2020-03-05

Family

ID=66184483

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/122718 Ceased WO2020042467A1 (zh) 2018-08-31 2018-12-21 图片压缩方法、装置、设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN109685861B (zh)
WO (1) WO2020042467A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110634098A (zh) * 2019-06-13 2019-12-31 眸芯科技(上海)有限公司 无损稀疏图像的显示方法、装置及系统
CN111768459A (zh) * 2020-06-28 2020-10-13 百度在线网络技术(北京)有限公司 图像处理方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110229027A1 (en) * 2010-03-16 2011-09-22 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and computer-readable medium
CN102523367A (zh) * 2011-12-29 2012-06-27 北京创想空间商务通信服务有限公司 基于多调色板的实时图像压缩和还原方法
CN107258081A (zh) * 2015-03-06 2017-10-17 高通股份有限公司 对使用非正方形分割编码视频数据的优化
CN108009984A (zh) * 2017-11-21 2018-05-08 中国地质大学(武汉) 一种面向水环境监测的水面显著性区域的检测方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103886623B (zh) * 2012-12-19 2017-03-15 华为技术有限公司 一种图像压缩方法、设备及系统
CN108399052B (zh) * 2018-02-07 2021-05-14 深圳壹账通智能科技有限公司 图片压缩方法、装置、计算机设备和存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110229027A1 (en) * 2010-03-16 2011-09-22 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and computer-readable medium
CN102523367A (zh) * 2011-12-29 2012-06-27 北京创想空间商务通信服务有限公司 基于多调色板的实时图像压缩和还原方法
CN107258081A (zh) * 2015-03-06 2017-10-17 高通股份有限公司 对使用非正方形分割编码视频数据的优化
CN108009984A (zh) * 2017-11-21 2018-05-08 中国地质大学(武汉) 一种面向水环境监测的水面显著性区域的检测方法

Also Published As

Publication number Publication date
CN109685861B (zh) 2022-03-15
CN109685861A (zh) 2019-04-26

Similar Documents

Publication Publication Date Title
US11373275B2 (en) Method for generating high-resolution picture, computer device, and storage medium
CN107967677B (zh) 图像处理方法、装置、计算机可读存储介质和计算机设备
US9836854B2 (en) Systems and methods for lossy compression of image color profiles
US11681745B2 (en) Digital image presentation
WO2021115242A1 (zh) 一种超分辨率图像处理方法以及相关装置
US9300840B2 (en) Image processing device and computer-readable storage medium storing computer-readable instructions
US20220138906A1 (en) Image Processing Method, Apparatus, and Device
CN113112422A (zh) 图像处理方法、装置、电子设备、计算机可读介质
CN111179370A (zh) 一种图片生成方法、装置、电子设备及存储介质
WO2016197705A1 (zh) 一种图像处理方法和装置
WO2017101487A1 (zh) 转码属性信息的提交方法和装置
CN107113464B (zh) 内容提供装置、显示装置及其控制方法
CN109272526B (zh) 图像处理方法、系统及电子设备
WO2020042467A1 (zh) 图片压缩方法、装置、设备及计算机可读存储介质
US11902522B2 (en) Character restoration method and apparatus, storage medium, and electronic device
CN106954004A (zh) 一种屏幕共享的方法及装置
US20160198051A1 (en) Image processing system, image output device, and image processing method
CN109685714B (zh) 图片压缩方法、装置、设备及计算机可读存储介质
CN110956572A (zh) 图像处理的方法、装置及系统
CN107608733B (zh) 图片显示方法、装置和终端设备
US10354125B2 (en) Photograph processing method and system
CN116030114B (zh) 物电同源电子印模的制作方法、装置、设备及介质
US12008034B2 (en) Digital image presentation
CN112114760A (zh) 图像处理方法及装置
WO2023207454A9 (zh) 图像处理方法、图像处理装置以及可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18931696

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 10/06/2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18931696

Country of ref document: EP

Kind code of ref document: A1