Picture compression method and device for application, equipment and program product

By integrating an image compression tool into the installation package build lifecycle to filter and convert images to WebP format, the problem of rapidly increasing mobile application memory usage was solved, resulting in a smoother user experience.

CN120994625AInactive Publication Date: 2025-11-21ROYPOW TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511485212.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2025-11-21
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When mobile applications are running, image display causes a sharp increase in memory usage, leading to interface rendering lag, operation response delays, and memory overflows, which affects the user experience.

Method used

The image compression tool is integrated into the build lifecycle of the installation package. By obtaining data from the compression tool, images to be compressed are selected, converted to WebP format, and stored in the original image directory, thereby reducing the size of the installation package and optimizing memory usage.

Benefits of technology

It effectively reduces the memory usage of images in applications, reduces rendering lag and operation response latency, lowers the chance of memory overflow, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994625A_ABST
    Figure CN120994625A_ABST
Patent Text Reader

Abstract

The invention relates to the field of application development, in particular to an application picture compression method and device, equipment and a program product. The method comprises the following steps: acquiring compression tool data, and storing the compression tool data to a predetermined project path; searching for a to-be-compressed picture included in the project resource needing to be constructed; calling a compression tool through an item path of the compression tool data to convert and compress the to-be-compressed picture, and storing the converted and compressed picture to a directory where an original picture is located; and constructing an installation package according to the converted and compressed pictures included in the same directory. According to the method, the picture can be automatically compressed in the construction process of the application program, the memory occupation amount of the picture of the application program can be effectively reduced, rendering lagging and operation response delay can be reduced, the memory overflow probability can be reduced, and the use experience of a user can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of application development, and in particular to image compression methods, apparatus, devices, and program products for applications. Background Technology

[0002] To enhance the user's visual experience and enrich mobile applications, the interface design of mobile applications is becoming increasingly sophisticated, and the number of image resources integrated into applications is also increasing.

[0003] During application runtime, image display requires decoding into bitmap data. The system needs to load the images into memory first. If there are multiple large images on the screen or the user quickly switches between images, memory usage will spike, easily triggering the system's memory limit. This not only causes screen rendering lag and operation response delays, but more commonly, it directly leads to Out of Memory Errors, causing the application to crash or become unresponsive, severely impacting the user experience. Summary of the Invention

[0004] In view of this, embodiments of this application provide an image compression method, apparatus, device, and program product for applications to solve the problem that applications in the prior art are prone to causing interface rendering lag, operation response delay, memory overflow, application crashes or unresponsiveness, and affecting user experience when running.

[0005] A first aspect of this application provides an image compression method for an application, the method comprising: Acquire compression tool data and store the compression tool data in a predetermined project path; Locate the images to be compressed within the project resources that need to be built; The compression tool is invoked through the project path of the compression tool data to perform conversion and compression processing on the image to be compressed, and the converted and compressed image is stored in the directory where the original image is located. The installation package is built based on the converted and compressed images included in the same directory.

[0006] In conjunction with the first aspect, in the first possible implementation of the first aspect, the images to be compressed included in the project resources to be constructed are located, including: The system detects images in the project resources that have been updated since the last build. Add updated images to the images to be compressed included in the project resources.

[0007] In conjunction with the first possible implementation of the first aspect, in the second possible implementation of the first aspect, detecting images in the project resources that have been updated since the last build includes: The system detects the first generation time of a first image and the second generation time of a second image within the same directory, where the first image is the image in its uncompressed format and the second image is the image in its compressed format. If the first generation time is later than the second generation time, then the first image is determined to be an image that has been updated since the last construction.

[0008] In conjunction with the first aspect, in the third possible implementation of the first aspect, the images to be compressed included in the project resources to be constructed are located, including at least one of the following methods: Images in the project resources are filtered according to a predetermined file size threshold; Images in the project resources are filtered according to a predetermined image size threshold; Images in the project resources are filtered according to a pre-defined whitelist.

[0009] In conjunction with the first aspect, in the fourth possible implementation of the first aspect, obtaining the compression tool data includes: Detect the current build environment; Based on the pre-defined correspondence between build environments and compression tool data, obtain the compression tool data corresponding to the current build environment.

[0010] In conjunction with the first aspect, in the fifth possible implementation of the first aspect, before calling the compression tool through the project path of the compression tool data to perform conversion and compression processing on the image to be compressed, the method further includes: Detect the format type of the image to be compressed; Obtain the compression method corresponding to the specified format type, and pre-compress the image to be compressed using the specified compression method.

[0011] In a sixth possible implementation of the first aspect, combining any one of the first to fifth possible implementations, after calling the compression tool through the project path of the compression tool data to perform conversion and compression processing on the image to be compressed, the method further includes: Store the converted and compressed images in the build cache; Alternatively, after acquiring the compression tool data, the method further includes: The compression tool data is stored in the tool cache.

[0012] A second aspect of this application provides an image compression apparatus, the apparatus comprising: A compression tool data acquisition unit is used to acquire compression tool data and store the compression tool data in a predetermined project path; The image to be compressed search unit is used to find the images to be compressed included in the project resources to be built; The conversion and compression processing unit is used to call the compression tool through the project path of the compression tool data to perform conversion and compression processing on the image to be compressed, and store the converted and compressed image in the directory where the original image is located. A build unit is used to build an installation package based on converted and compressed images included in the same directory.

[0013] A third aspect of this application provides an image compression device for an application, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the image compression device for the application implements the method described in any of the first aspects.

[0014] A fourth aspect of this application provides a computer program product that, when run on a computer, causes the computer to execute the methods described in the first aspect or its various implementations.

[0015] A fifth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method as described in any of the first aspects.

[0016] A sixth aspect of this application provides a chip for implementing the methods in the various implementations of the first aspect described above. Specifically, the chip includes a processor for calling and running a computer program from a memory, causing a device equipped with the chip to perform the methods as described in the first aspect or its various implementations.

[0017] The beneficial effects of this application embodiment compared with the prior art are as follows: This application embodiment obtains compression tool data and stores it in a predetermined project path. By finding the images to be compressed included in the project resources to be built, the compression tool is called based on the project path of the compression tool data to perform conversion and compression processing on the images to be compressed. The converted and compressed images are stored in the directory where the original images are located, and the installation package is built based on the converted and compressed images included in the same directory. Thus, the image compression processing can be automatically completed during the application building process, which can effectively reduce the memory occupation of images in the application, reduce rendering lag and operation response latency, reduce the probability of memory overflow, and help improve the user experience. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram illustrating the implementation process of an image compression method provided in an embodiment of this application; Figure 2 This is a schematic diagram illustrating the implementation process of a method for detecting an image to be compressed, as provided in an embodiment of this application. Figure 3 This is a schematic diagram illustrating the implementation process of a method for detecting updated images provided in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the implementation process of an image precompression method provided in an embodiment of this application; Figure 5 This is a schematic diagram of an image compression device provided in an embodiment of this application; Figure 6 This is a schematic diagram of an image compression device provided in an embodiment of this application. Detailed Implementation

[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0021] To illustrate the technical solution described in this application, specific embodiments are provided below.

[0022] As mobile applications increasingly demand higher visual experiences and their interfaces become more sophisticated, image resources are being used more extensively and intensively. During application runtime, images must first be loaded into memory and decoded into bitmap format before display. When multiple high-resolution images are loaded simultaneously, or when users frequently switch between images, memory consumption increases rapidly, easily reaching system memory limits. This can not only cause performance issues such as interface lag and operational delays, but in more severe cases, it can lead to Out of Memory Errors, causing application crashes or unresponsiveness, significantly degrading the user experience.

[0023] To address the aforementioned issues, this application proposes an image compression method that deeply integrates image compression tools into the installation package's build lifecycle. This enables automatic, batch, and configurable format conversion, significantly improving development efficiency and effectively reducing the installation package size. Figure 1 The implementation flow of this method is illustrated in detail below: In S101, compression tool data is acquired and stored in a predetermined project path.

[0024] WebP is an image format with excellent lossless and lossy compression capabilities. Compared to PNG, WebP compression can typically reduce image file size by about 26% while maintaining the same visual quality. This is significant for reducing installation package size, saving user bandwidth, and improving the download experience. Therefore, the compression tool in this embodiment can be a conversion and compression tool for converting and compressing images to WebP format, such as the cwebp tool, which can be used to convert images in PNG, JPEG, and other formats to WebP format. The compression tool data can be an executable file that runs directly under the current operating system.

[0025] Because compression tool data differs across operating systems, when obtaining compression tool data, the current build environment can be detected first. Then, based on the predefined correspondence between build environments and compression tool data, the compression tool data corresponding to the current build environment can be determined. For example, in a Windows build environment, the compression tool data is the executable file cwebp.exe, while in a macOS or Linux build environment, the compression tool data is cwebp binary data in ELF format.

[0026] In this embodiment of the application, the build tool can be Gradle, Bazel, or similar tools. Different build environments can select a suitable build tool, and the installer can be built according to the build approach described in this embodiment.

[0027] The predefined project path is a directory that can be accessed by the build tool at any time. For example, when the build tool is Gradle, the predefined project path can be the project's local directory, such as project.rootDir / tools / cwebp, which is configured as the execution environment for Gradle tasks.

[0028] In possible implementations, the embodiments of this application can acquire the compression tool data through automatic download, automatic distribution, or manual copying. To improve the effectiveness of image compression, after obtaining the compression tool data, its integrity can be verified. For example, the summary information of the obtained compression tool data can be calculated, and the calculated summary result can be compared with pre-set summary standard information. If they are the same, it means that the obtained compression tool data has been successfully verified; if they are different, it means that the obtained compression tool data is incorrect and needs to be downloaded again, or the remaining data needs to be acquired.

[0029] In S102, locate the images to be compressed included in the project resources to be built.

[0030] In this embodiment, "project resources" refers to data resources used to build the installation package. "Images to be compressed" refers to images located within the project resources that are permitted for compression. These images may include formats such as PNG and JPEG. Images of predetermined formats included in the project resources can be obtained through iteration, and then filtered using predetermined rules to obtain the images that need to be converted and compressed. For example, the images to be compressed can be PNG or JPEG images that can be converted and compressed using Gradle tools.

[0031] The filtering based on predetermined filtering rules may include at least one of the following methods, that is, it may include one, two or three of the above methods: Images in the project resources are filtered according to a predetermined file size threshold; images in the project resources are filtered according to a predetermined image size threshold; and images in the project resources are filtered according to a predetermined whitelist.

[0032] In order to quickly filter out images that consume a lot of memory during application runtime, this application embodiment can set a file size threshold, such as 2MB. When the image size is greater than 2MB, the image is filtered out as an image to be compressed. Alternatively, it can be further combined with other rules to determine whether it is an image to be compressed, such as filtering in conjunction with a whitelist.

[0033] Considering that excessively large images consume significant memory, potentially causing memory overflows, UI rendering lag, and sluggish interface response, image size thresholds can be set to filter large images from project resources. These thresholds can include height and width thresholds; for example, both could be set to 2048 pixels. If an image's width exceeds the width threshold, it's considered a large image; similarly, if its height exceeds the height threshold, it's also considered a large image. Alternatively, further rules can be used to determine whether an image needs compression, such as combining it with a whitelist for filtering.

[0034] Considering the display requirements of certain images, if image compression might cause functional abnormalities or display errors, these images will be added to a whitelist. In other words, even if an image is determined to require compression based on file size or image dimensions thresholds, it may be exempt from compression because it is a whitelisted image. This includes images with specific requirements, deeply optimized images, UI elements requiring precise alignment, and images based on specific functional needs. For example, application icons or launch icons often have strict format and hierarchy requirements; automatic compression might damage transparency, color levels, or cropped areas, potentially leading to display abnormalities. Therefore, these types of images can be added to the whitelist.

[0035] One possible implementation is to first compare the image with a whitelist. If the image is not on the whitelist, further comparison can be made using file size thresholds and / or image size thresholds, which can effectively reduce the filtering operations for whitelisted images.

[0036] In possible implementations, the application's installation package may undergo multiple updates, during which some images may be updated. To improve the build efficiency of the application's installation package, this embodiment can improve the build speed by detecting increments. Specifically, it can be as follows: Figure 2 As shown, it includes: In S201, it is detected that there are updated images in the project resources since the last build.

[0037] Images that have already been built can be stored using caching. During the previous build, the converted and compressed images, along with the original images, are stored in the same directory as the images to be compressed. If the original images are updated after the build is complete, the converted and compressed images stored in that directory will not correspond to the updated images. The updated images will then need to be converted and compressed again, eliminating the need to convert and compress all images, thus improving the build efficiency of the installation package.

[0038] In one possible implementation, the image generation time can be used to determine if there are any updated images since the last build. Specifically, this can be achieved as follows: Figure 3 As shown, it includes: In S301, the first generation time of the first image and the second generation time of the second image in the same directory are detected.

[0039] The first image is the image in its original format before compression, and the second image is the image in its compressed format. The first and second images can have the same name but different formats. The first image is in its original format, and the second image can be in its compressed format. The identical names allow for quick and efficient matching of the first and second images.

[0040] When a first image and a second image exist in the same directory, since the same directory stores both the first image before conversion and compression and the second image after conversion and compression, the order in which the first and second images were created can be determined by comparing their creation times. The creation time of an image is also the time it was last modified.

[0041] In S302, if the first generation time is later than the second generation time, then the first image is determined to be an image that has been updated since the last construction.

[0042] If the first image's initial generation time is later than the second image's initial generation time, it indicates that the first image was modified after the second image was generated through conversion and compression, such as by changing its content. In this case, the first image is determined to be an image that has been updated since the last build. It needs to be re-converted and compressed to reduce the application's memory usage, improve application smoothness, and enhance the user experience.

[0043] In a possible implementation, the first generation time of the first image can also be compared with the time of the last build. If it is later than the time of the last build, then the image is determined to be an image that has been updated since the last build.

[0044] In S202, updated images are added to the images to be compressed included in the project resources.

[0045] If images are updated after the last build, and these updated images were previously identified as images to be compressed (e.g., those identified through filtering), then the updated images will typically also be images to be compressed. Alternatively, the updated images can be re-filtered based on the filtering rules to determine if they are images to be compressed. If they are, the updated images are added to the list of images to be compressed in the project resources and subjected to conversion and compression. Otherwise, the images are not added to the list of images to be compressed in the project resources, and no conversion or compression is performed on them.

[0046] In possible implementations, to further improve the accuracy of image update judgment, the first image from the last construction, i.e., the first summary information of the original image, can be obtained and compared with the second summary information of the first image at the current moment. If the two are the same, it means that the image has not been updated since the last construction. If the two are different, it means that the first image has been updated since the last construction. The updated image is added to the images to be compressed included in the project resources and converted and compressed.

[0047] In possible implementations, embodiments of this application may also detect whether configuration parameters or filtering rules have changed. If a change in configuration parameters or filtering rules is detected, all images need to be re-filtered using the new filtering rules or configuration parameters, and the images to be compressed are then converted and compressed based on the filtered images. Configuration parameters may include image quality parameters, etc. By configuring quality parameters, it can be determined which images participate in the conversion and compression filtering; by using filtering rules, it can be determined which images can be filtered out as images to be compressed.

[0048] In possible implementations, to improve the compression effect of images, embodiments of this application may also perform pre-compression processing on the images to be compressed, such as... Figure 4 As shown, the pre-compression process may include: In S401, the format type of the image to be compressed is detected.

[0049] The image formats to be compressed can include PNG and JPEG formats, among others.

[0050] In S402, the compression method corresponding to the format type is obtained, and the image to be compressed is pre-compressed using the compression method.

[0051] Depending on the format of the image to be compressed, the corresponding compression method can be obtained. For example, for a PNG image, the pngquant compression tool can be used for compression, and for a JPEG image, the guetzli compression tool can be used. The pre-compressed image is then saved to an input file and input into a compression tool for conversion and compression, such as cwebp, to obtain a WebP format image.

[0052] In S103, the compression tool is invoked through the project path of the compression tool data to perform conversion and compression processing on the image to be compressed, and the converted and compressed image is stored in the directory where the original image is located.

[0053] Based on the project path where the executable file of the obtained compression tool data is located, the executable file of the compression tool can be called, the image to be compressed can be sent to the compression tool, and a conversion and compression command can be sent to the executable file of the compression tool to perform conversion and compression processing on the selected images to be compressed, so as to obtain a new image format with a significantly reduced storage space and memory usage, such as WebP format images.

[0054] To facilitate the construction of the installation package, the converted and compressed images are stored in the same directory as the original images before conversion and compression. This ensures that the constructed installation package can run accurately and reliably. The original and converted / compressed images reside in the same directory, and their names and extensions can differ. Using two images with the same name in the same directory allows for quick and easy identification of the correspondence between the original and converted / compressed images.

[0055] In S104, the installation package is built based on the converted and compressed images included in the same directory.

[0056] When building an installation package from converted and compressed images within the same directory, simply select the converted and compressed images and pull the smaller image into the installation package to build the application installation package. If the same directory only contains the original image and the converted and compressed image, they can be directly compared and selected. If the same directory contains multiple images, the first image before conversion and the second image after conversion and compression can be set to have the same name but different file extensions. For two images with the same name, only the smaller second image needs to be pulled to build the application installation package.

[0057] For example, if a directory contains two images, bg_login.png and ic_login.png, with sizes of 3.2MB and 20KB respectively, ic_login.png doesn't need compression since its size is less than the file size threshold, while bg_login.png does, requiring compression. After compression, the resulting image is bg_login.webp, which is 300KB, significantly smaller than its uncompressed size of 3.2MB. During the build process, since the directory contains two images with the same name but different extensions (bg_login.png and bg_login.webp), only the smaller bg_login.webp image needs to be used for the installation package.

[0058] In possible implementations, to reduce redundant data downloads and conversions, this embodiment can further store the converted and compressed image in the build cache after calling the compression tool through the project path of the compression tool data to perform conversion and compression processing on the image to be compressed. The tool cache and build cache are two caches included in the build tool, and the data in them is not cleared during a clean build. After obtaining the compression tool data, the compression tool data is stored in the tool cache. Since the tool cache and build cache are not cleared during a clean build, the previously converted and compressed image can be directly used in the next build, and the image can be converted and compressed through incremental updates, improving the application's build efficiency. Furthermore, the compression tool in the tool cache is not cleared during a clean build, and the already obtained compression tool can be used for building, which is beneficial for improving build efficiency.

[0059] In addition, to improve operational convenience, embodiments of this application can build plugins to provide extended interfaces, allowing users to configure the build process. For example, at least one of the following plugins can be built: a. Master switch, used to control the start and stop of the build operation; b. Whether to check image size (enabled by default, used to determine whether to start checking the file size of images); c. File size threshold, such as 2MB; d. Whether to check large pixel images (used to detect whether the pixels of the image, including width and height, exceed the set pixel number threshold); e. Image width threshold, such as 2048 pixels; f. Image height threshold, such as 2048 pixels; g. Whitelist set, which does not process images; h. Whether to enable multi-threaded image processing (enabled by default); i. Image format to be converted; j. Input file path; k. Output file path; m. Compression mode resolution: n compression mode (select different modes according to resolution).

[0060] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0061] Figure 5 This is a schematic diagram of an image compression device for an application provided in an embodiment of this application. The device includes: Compression tool data acquisition unit 501 is used to acquire compression tool data and store the compression tool data to a predetermined project path; The image to be compressed search unit 502 is used to search for images to be compressed included in the project resources to be built; The conversion and compression processing unit 503 is used to call the compression tool through the project path of the compression tool data to perform conversion and compression processing on the image to be compressed, and store the converted and compressed image in the directory where the original image is located. Build unit 504 is used to build an installation package based on the converted and compressed images included in the same directory.

[0062] Figure 5 The image compression device shown in the application, and Figure 1 The image compression method shown corresponds to the application.

[0063] Figure 6 This is a schematic diagram of an image compression device provided in an embodiment of this application. For example... Figure 6 As shown, the image compression device 6 of this embodiment includes: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60, such as an image compression program for the application. When the processor 60 executes the computer program 62, it implements the steps in the image compression method embodiments of the various applications described above. Alternatively, when the processor 60 executes the computer program 62, it implements the functions of each module / unit in the various device embodiments described above.

[0064] For example, the computer program 62 may be divided into one or more modules / units, which are stored in the memory 61 and executed by the processor 60 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 62 in the image compression device 6 of the application.

[0065] The image compression device 6 of the application can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. The image compression device of the application may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will understand that... Figure 6 This is merely an example of an image compression device 6 for one application and does not constitute a limitation on the image compression device 6 for that application. It may include more or fewer components than shown, or combine certain components, or different components. For example, the image compression device for the application may also include input / output devices, network access devices, buses, etc.

[0066] The processor 60 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0067] The memory 61 can be an internal storage unit of the image compression device 6 of the application, such as a hard drive or memory of the image compression device 6. The memory 61 can also be an external storage device of the image compression device 6 of the application, such as a plug-in hard drive, Smart MediaCard (SMC), Secure Digital (SD) card, or Flash Card equipped on the image compression device 6 of the application. Furthermore, the memory 61 can include both internal storage units and external storage devices of the image compression device 6 of the application. The memory 61 is used to store the computer program and other programs and data required by the image compression device of the application. The memory 61 can also be used to temporarily store data that has been output or will be output.

[0068] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0069] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0070] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0071] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0072] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0073] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0074] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by hardware related to computer program instructions. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0075] In addition, this application also provides a computer program product that, when run on a computer, causes the computer to execute the methods in the above-described implementations.

[0076] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A picture compression method for an application, characterized by, The method comprises: acquiring compression tool data and storing the compression tool data to a predetermined project path; finding a to-be-compressed picture included in project resources that need to be built; calling a compression tool through the project path of the compression tool data to perform conversion compression processing on the to-be-compressed picture, and storing the picture compressed and converted into a directory where the original picture is located; performing installation package building according to the picture compressed and converted included in the same directory.

2. The method of claim 1, wherein, The finding of the to-be-compressed picture included in the project resources that need to be built comprises: detecting a picture that is updated after the last building in the project resources; adding the picture that is updated to the to-be-compressed picture included in the project resources.

3. The method of claim 2, wherein, The detection of the picture that is updated after the last building in the project resources comprises: detecting a first generation time of a first picture and a second generation time of a second picture included in the same directory, wherein the first picture is a picture in a format before conversion compression, and the second picture is a picture in a format after conversion compression; when the first generation time is later than the second generation time, it is determined that the first picture is a picture that is updated after the last building.

4. The method of claim 1, wherein, The finding of the to-be-compressed picture included in the project resources that need to be built comprises at least one of the following manners: screening the pictures in the project resources according to a predetermined file size threshold; screening the pictures in the project resources according to a predetermined picture size threshold; screening the pictures in the project resources according to a predetermined white list.

5. The method of claim 1, wherein, The acquisition of the compression tool data comprises: detecting a current building environment; acquiring the compression tool data corresponding to the current building environment according to a predetermined corresponding relationship between building environments and compression tool data.

6. The method of claim 1, wherein, Before the calling of the compression tool through the project path of the compression tool data to perform conversion compression processing on the to-be-compressed picture, the method further comprises: detecting a format type of the to-be-compressed picture; acquiring a compression method corresponding to the format type, and performing pre-compression processing on the to-be-compressed picture through the compression method.

7. The method according to any one of claims 1 to 6, characterized in that, After the calling of the compression tool through the project path of the compression tool data to perform conversion compression processing on the to-be-compressed picture, the method further comprises: storing the picture compressed and converted into a building cache; or, after the acquisition of the compression tool data, the method further comprises: storing the compression tool data into a tool cache.

8. An image compression apparatus for use, characterized by, The apparatus comprises: a compression tool data acquisition unit configured to acquire compression tool data and store the compression tool data to a predetermined project path; a to-be-compressed picture finding unit configured to find a to-be-compressed picture included in project resources that need to be built; a conversion compression processing unit configured to call a compression tool through the project path of the compression tool data to perform conversion compression processing on the to-be-compressed picture, and store the picture compressed and converted into a directory where the original picture is located; a building unit configured to perform installation package building according to the picture compressed and converted included in the same directory.

9. An image compression apparatus of an application, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program, so that the picture compression device of the application implements the method according to any one of claims 1-7.

10. A computer program product comprising computer program instructions, characterised in that, The computer program, which is run, causes the method as claimed in any one of claims 1 to 7 to be performed.

Citation Information

Patent Citations

  • Method and device for publishing game program, storage medium and computer equipment

    CN112245911A

  • Installation package picture processing method and device, computer equipment and storage medium

    CN114995850A

  • Picture compression method and compression device

    CN116055728A

  • Resource file management method and device and electronic equipment

    CN118778936A