Image processing method, device, equipment and storage medium

By decompressing the initial resource package of the application and uniformly compressing the images, the problem of low image compression efficiency in the existing technology is solved, and a smaller application package size and a higher download conversion rate are achieved.

CN115937335BActive Publication Date: 2025-09-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110919019.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-11
Publication Date
2025-09-12
Estimated Expiration
2041-08-11

AI Technical Summary

Technical Problem

The existing technology is inefficient and incomplete in compressing images in applications, resulting in a large application package size and affecting the download conversion rate.

Method used

By obtaining the initial resource package corresponding to the target application, decompressing and extracting the original image, and performing unified image compression processing on it, the target image required by the target application is generated.

Benefits of technology

It improves the comprehensiveness and efficiency of image compression, reduces the size of application packages, and improves download conversion rates and loading speeds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115937335B_ABST
    Figure CN115937335B_ABST
Patent Text Reader

Abstract

The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, device, and storage medium. The method comprises: obtaining an initial resource package corresponding to a target application; the initial resource package is generated based on compiling an initial resource file, and the initial resource file includes an original image corresponding to the target application; decompressing the initial resource package and extracting the original image from the decompressed file; and performing image compression processing on the original image to obtain a target image for generating the target application. The present application can ensure that images involved in the target application are fully compressed, thereby improving the comprehensiveness of image compression and improving the efficiency of image compression.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, device and storage medium. Background Art

[0002] As apps become increasingly powerful and user device resolutions increase, a better user experience requires adding many high-resolution images to apps, which results in larger app packages. This increase in package size directly impacts download conversion rates, as larger packages increase the time users have to wait to download. This increased wait time can lead users to cancel the download, reducing download conversion rates. To reduce the size of app packages, images within them can be compressed.

[0003] The initial resource files corresponding to the application generally include custom resource files and third-party resource files; in the prior art, before compiling the initial resource files corresponding to the application, the images in the custom resource files involved in each custom module are compressed separately. Performing image compression separately in each custom module results in low image compression efficiency; in addition, the existing image compression method does not compress images in third-party resource files, resulting in incomplete compression of images in the application. Summary of the Invention

[0004] The present application provides an image processing method, apparatus, device and storage medium, which can solve the problems of low image compression efficiency and incomplete image compression when compressing images in applications in the prior art.

[0005] In order to solve the above technical problems, on the one hand, the present application provides an image processing method, including:

[0006] Obtaining an initial resource package corresponding to a target application; the initial resource package is generated based on compiling an initial resource file, the initial resource file including an original image corresponding to the target application;

[0007] Decompressing the initial resource package and extracting the original image from the decompressed file;

[0008] The original image is compressed to obtain a target image for generating the target application.

[0009] On the other hand, the present application provides an image processing device, comprising:

[0010] An initial resource package acquisition module is used to acquire an initial resource package corresponding to a target application; the initial resource package is generated based on compiling an initial resource file, the initial resource file including an original image corresponding to the target application;

[0011] An initial resource package decompression module, configured to decompress the initial resource package and extract the original image from the decompressed file;

[0012] The image compression module is used to perform image compression processing on the original image to obtain a target image for generating the target application.

[0013] On the other hand, the present application provides a device comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the image processing method as described above.

[0014] On the other hand, the present application provides a computer storage medium, which stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by a processor as the above-mentioned image processing device.

[0015] The implementation of the embodiments of the present application has the following beneficial effects:

[0016] The target application will have an initial resource package corresponding to it. The initial resource package is generated based on the compilation of the initial resource file. The initial resource file includes the original image corresponding to the target application. The present application obtains the initial resource package corresponding to the target application, decompresses the initial resource package, and obtains the original image corresponding to the target application. The original image is compressed to obtain the target image, which is the image used to generate the target application. Since the initial resource package includes developer-defined resource files and third-party resource files, the initial resource package contains the original image corresponding to the target application. Image compression processing based on the initial resource package can ensure that the images involved in the target application are fully compressed, thereby improving the comprehensiveness of image compression. In addition, image compression processing based on the initial resource package can achieve unified and centralized processing of images, avoiding the problem of low compression efficiency caused by performing image compression processing in different custom modules, thereby improving the efficiency of image compression. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0018] Figure 1 This is a flow chart of an image processing method provided in an embodiment of the present application;

[0019] Figure 2 This is a flow chart of a method for generating an initial resource package provided by an embodiment of the present application;

[0020] Figure 3 This is a schematic diagram of the resource compilation process provided by the embodiment of the present application;

[0021] Figure 4 This is a flow chart of an original image extraction method provided in an embodiment of the present application;

[0022] Figure 5 This is a flow chart of a target image generation method provided in an embodiment of the present application;

[0023] Figure 6 This is a flow chart of a method for generating a target resource package provided by an embodiment of the present application;

[0024] Figure 7 This is a flow chart of a method for updating a target resource index file provided by an embodiment of the present application;

[0025] Figure 8 This is a flow chart of a target image determination method provided by an embodiment of the present application;

[0026] Figure 9 This is a schematic diagram of an image processing device provided in an embodiment of the present application;

[0027] Figure 10 This is a schematic diagram of a device structure provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] To make the objectives, technical solutions, and advantages of this application more clear, this application will be further described in detail below with reference to the accompanying drawings. It is clear that the embodiments described are only some of the embodiments of this application, and not all of them. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0030] First, the relevant terms involved in the embodiments of this specification are explained as follows:

[0031] App: Application, the main program in an Android project, can be compiled into an executable APK.

[0032] APK: Android application package, an application package file format used by the Android operating system.

[0033] Lib: Dependent package, dependent module in Android project, dependent on other libs or apps, and does not have independent running module.

[0034] Module: A general term for individual projects in Android, including the above App and Lib.

[0035] AAR: A format for dependency packages, including code, resources, etc.

[0036] resource.arsc file: It is an index file generated by the resource file during the compilation process. This index file is used to find the corresponding resources in the program.

[0037] _ap file: This is a zip file, which mainly contains res resource files, manifest files, and the relationship between the above App, Lib, and Module.

[0038] In order to solve the problems of low image compression efficiency and incomplete image compression in the prior art when compressing images in applications, the present invention provides an image processing method. Figure 1 , the method may specifically include:

[0039] S110. Acquire an initial resource package corresponding to the target application; the initial resource package is generated based on compiling an initial resource file, the initial resource file including an original image corresponding to the target application.

[0040] The image processing method in this application can be applied during the compilation of an application in an Android system. That is, the compilation of the application and the processing of the application's original images can be performed simultaneously. The compilation of the application and the compression of the original images can be implemented based on different processes, so that the two do not affect each other. This can not only avoid the aliasing of the processing flows of the two, but also speed up the processing speed, thereby improving the overall efficiency of the compilation and processing of the application. This application can also be applied to other related implementation scenarios, which are not specifically limited in this embodiment.

[0041] Specifically, the target application includes multiple program modules; the program module Module here may include the program module customized by the developer in the application development process to achieve the target function, and the non-customized dependency package Lib called to achieve the target function. The non-customized dependency package Lib here can generally refer to a third-party or official open source Lib; accordingly, the initial resource files corresponding to the application generally include custom resource files and non-customized resource files. The custom resource files are resource files corresponding to the custom program modules, which contain relevant resource files set by the developer; the non-customized resource files are resource files corresponding to the non-customized dependency package Lib, which can be directly obtained and called.

[0042] The resource files contained in custom resource files and non-custom resource files are generally discrete. Here, you can merge the resource files to generate the initial resource package accordingly. Figure 2 , which shows a method for generating an initial resource package, which may include:

[0043] S210. Merge the image resources in the multiple program modules.

[0044] S220. Compile the merged image resources to generate an image attribute file corresponding to each image.

[0045] S230. Generate the initial resource package based on the image attribute file corresponding to each image.

[0046] The method for generating the initial resource package during the compilation process may specifically include:

[0047] packageDebugResource: This step packages the image resources in each program module separately. The input file is the image under src / main / res / src / debug / res / , and the output is the packaged image data package.

[0048] mergeDebugResources: This step merges and aggregates image data packets from multiple program modules for unified and centralized processing, improving processing efficiency. Specifically, it uses aapt2 to compile each image in the merged image resources and generate corresponding image attribute files. These image attribute files can identify image characteristics, such as image identification information, image size, image text, image color, image category information, and image path information.

[0049] processDebugResources: Links the compiled files based on aapt2. Specifically, based on each image property file, it determines the corresponding image and the image's path in the initial resource bundle. Based on this determined information, the initial resource bundle can be generated.

[0050] Accordingly, see Figure 3 , which shows the resource compilation flow chart, consisting of Figure 3 It can be seen that the initial resource files corresponding to the application generally include custom resource files and non-custom resource files. Custom resource files can refer to resource files in each program module in the figure, and non-custom files can be preset dependency packages directly called in the figure, specifically dependent AAR files or dependent Maven resources; the resource files in each program module are packageDebugResource processed to obtain resource packaging results; then the resource packaging results of each program module and the preset dependent program package are mergeDebugResources and processDebugResources to obtain the initial resource package. The image compression time in this embodiment is to process the initial resource package ._ap file. The ._ap file contains all the image files in this application, so the compression of this file can compress the images to the maximum extent. It can be seen that in this embodiment, the initial resource package contains the images in each program module and the images in each preset dependency package, so that when image processing is performed based on the initial resource package, all images involved in the target application are concentrated in the initial resource package, which can ensure the comprehensiveness of image processing and no images are missed.

[0051] For example, the language type of an image can be determined based on the text information in the image attribute file. The language type may include Chinese, English, etc. Assuming that Image 1 is Chinese and Image 2 is English, a path corresponding to Chinese and a path corresponding to English can be set in the initial resource package to be generated. Image 1 can be placed in the path corresponding to Chinese, and Image 2 can be placed in the path corresponding to English. The corresponding initial resource package can then be generated. It should be noted that the paths corresponding to images determined based on the image attribute file can overlap, meaning that images with at least two identical feature information items can correspond to the same path.

[0052] The original image here may refer to an image required for generating a target application. However, in this embodiment, the original image is not directly used to generate the target application. Instead, the original image is processed and the target application is generated based on the processed image.

[0053] S120. Decompress the initial resource package and extract the original image from the decompressed file.

[0054] The decompressed file includes the initial resource file and the initial resource index file; specifically, the decompressed file can be presented in the form of a project folder, which contains several folders, which correspondingly contain multiple paths. The pictures in the initial resource file are under the corresponding paths, and the specific paths here can be determined according to the picture attribute file mentioned above; the initial resource index file can be used to identify the path information of the initial resource in the current project folder, that is, the corresponding resource can be found according to the index information in the initial resource index file; so when extracting pictures, please refer to Figure 4 , which shows a method for extracting an original image, which may include:

[0055] S410. Determine the target path where the original image is located based on the initial resource index file.

[0056] S420. Extract the original image from the target path.

[0057] Specifically, the initial resource package can be a ._ap file. The ._ap file is a compressed file, and its content is some resource files written into the APK. After decompressing it, the files that can be obtained include: AndroidManifest.xml file, initial resource file Res file, and initial resource index file Resource.arsc. The AndroidManifest.xml file is the manifest file contained in the Android application project, and the manifest file is used to describe application-related information. The decompressed initial resource package is presented in the form of multiple folders. For example, the original image is generally placed in the drawable folder and the mipmap folder. The original image can be extracted from these two folders for processing. Based on the index information in the initial resource index file, the specific path of the original image is determined, and the corresponding original image is extracted from the determined specific path, thereby improving the efficiency of image extraction.

[0058] S130. Perform image compression processing on the original image to obtain a target image for generating the target application.

[0059] For the specific image compression process, please refer to Figure 5 , which shows a method for generating a target image, which may include:

[0060] S510. Obtain an image compression command, where the image compression command includes image compression parameters; the image compression parameters are used to represent attribute information of the compressed image.

[0061] S520. Perform image compression processing on the original image using the image compression command to obtain the target image corresponding to the image compression parameter.

[0062] The specific image compression command can be:

[0063] Cwebp-mt-quiet-q 75sample.png-o sample_compress.webp

[0064] The image compression parameters can be parameters related to image compression properties, such as image quality and whether to use lossy or lossless compression. For example, -q 75 specifies a compression parameter from 0 to 100 for the RGB channels, with a default value of 75. For lossy compression (the default), smaller parameters result in lower image quality and smaller file sizes, with 100 being the optimal quality parameter. For lossless compression (specifying the -lossless parameter), smaller parameters result in faster compression but larger file sizes, with a maximum compression value of 100. sample.png is the name of the original image.

[0065] Each original image is compressed using the above-mentioned image compression command, wherein the image compression parameters in the image compression command can be set arbitrarily, thereby obtaining a target image corresponding to the image compression parameters.

[0066] By compressing the original image through an image compression instruction that can adjust the image compression parameters, the convenience of image compression can be improved on the one hand, and on the other hand, a compressed image corresponding to the corresponding image compression parameters can be adaptively generated, thereby improving the flexibility of image compression.

[0067] See also Figure 6 , which shows a method for generating a target resource package, which may include:

[0068] S610. Update the original image under the target path of the initial resource file to the target image to obtain a target resource file.

[0069] S620. Based on the target image and the target path of the target image in the target resource file, update the initial resource index file to obtain a target resource index file.

[0070] S630. Generate a target resource package based on the target resource file and the target resource index file.

[0071] When all files are compressed, you need to compress the compressed image files, resource.arsc and AndroidManifest.xml files into .ap_ files to replace the original .ap_ files. The subsequent process can use this .ap_ file to continue the subsequent packaging tasks.

[0072] By updating the target resource file and target resource index file, a target resource package for generating a target application is obtained. Compared with the initial resource package, the target resource package occupies a smaller volume, thereby saving system processing resources and making the target application generated based on the target resource package smaller in size.

[0073] See also Figure 7 , which shows a method for updating a target resource index file, including:

[0074] S710. Determine identification information of the target image.

[0075] S720. Construct a correspondence between the target path where the target image is located and the identification information of the target image.

[0076] S730. Based on the corresponding relationship, update the initial resource index file to obtain the target resource index file.

[0077] The initial resource index file contains multiple index information. For example, if the original image is sample.png, the previous index R.drawable.sample will point to the sample.png file. After the sample.png file is compressed, the sample.webp file is obtained. The sample.png file under the R.drawable.sample path is replaced with the sample.webp file. It can be seen that the image suffix has changed. Therefore, the index value pointing to the file needs to be updated, that is, the value of R.drawable.sample needs to be updated to point to the sample.webp file.

[0078] By updating the initial resource index file, index information related to the compressed image can be obtained, so that the path information of the target image can be identified, which facilitates subsequent processing based on the target image.

[0079] Since the purpose of compressing the original image in the embodiment of the present application is to obtain a compressed image that occupies a smaller memory than the original image, in order to specifically determine the process of the target image, a corresponding preset compression memory can be set for comparison with the memory occupied by the compressed image; please refer to Figure 8 , which shows a target image determination method, the method may include:

[0080] S810. Compare the memory occupied by the compressed image with the preset compression memory.

[0081] S820. Determine whether the memory occupied by the compressed image meets the preset compression memory; if so, execute step S830; if not, execute step S840.

[0082] S830. Determine the compressed image as the target image.

[0083] S840. Recompress the original image.

[0084] S850. Determine whether the number of times the original image is compressed exceeds a preset number; if so, execute step S860; if not, execute step S810.

[0085] S860. Determine the original image as the target image.

[0086] The preset compression memory here can be a value a or a range of values ​​from b to c. For example, when the memory occupied by the compressed image is less than a, it can be determined that the memory occupied by the compressed image meets the preset compression memory. Alternatively, when the memory occupied by the compressed image falls within the range from b to c, it can also be determined that the memory occupied by the compressed image meets the preset compression memory. Accordingly, when the memory occupied by the compressed image does not meet the preset compression memory, the original image is recompressed. Recompression can specifically include modifying the image compression parameters of the current compression method or selecting another candidate image compression method. The specific method can be determined based on the implementation and is not limited here. For example, the original image size is 39k and the preset compression memory is 28-30k. Using lossy compression with -q 75, the compressed image size is 10.45k, which does not meet the preset compression memory. Then, using lossless compression, the compressed image size is 28.83k, which meets the preset compression memory. The lossless compressed image is then determined as the target image.

[0087] Therefore, when the compressed image does not meet the compression requirements, the compression method can be flexibly changed, thereby improving the flexibility and adaptability of image compression.

[0088] In addition, after the original image is compressed, information describing the image compression details can be generated in the relevant directory. Specifically, a compression report can be output in the build / report / directory to indicate which files are compressed and the corresponding compression ratio.

[0089] The target application will have an initial resource package corresponding to it. The initial resource package is generated based on the compilation of the initial resource file. The initial resource file includes the original image corresponding to the target application. The present application obtains the initial resource package corresponding to the target application, decompresses the initial resource package, and obtains the original image corresponding to the target application. The original image is compressed to obtain the target image, which is the image used to generate the target application. Since the initial resource package includes developer-defined resource files and third-party resource files, the initial resource package contains the original image corresponding to the target application. Image compression processing based on the initial resource package can ensure that the images involved in the target application are fully compressed, thereby improving the comprehensiveness of image compression. In addition, image compression processing based on the initial resource package can achieve unified and centralized processing of images, avoiding the problem of low compression efficiency caused by performing image compression processing in different custom modules, thereby improving the efficiency of image compression.

[0090] This application compresses the original image corresponding to the application and generates a target resource package based on the compressed image, so that the target application generated based on the target resource package has a smaller size, avoiding the long waiting time for users to download due to the large size of the application package, which in turn leads to a reduced download conversion success rate.

[0091] Furthermore, the reduced size of the application can speed up its loading speed, quickly download the upgrade package when upgrading, and reduce the memory usage of the terminal device.

[0092] This embodiment also provides a picture processing device, see Figure 9 , the device may include:

[0093] An initial resource package acquisition module 910 is configured to acquire an initial resource package corresponding to a target application; the initial resource package is generated by compiling an initial resource file, the initial resource file including original images corresponding to the target application;

[0094] An initial resource package decompression module 920 is configured to decompress the initial resource package and extract the original image from the decompressed file;

[0095] The image compression module 930 is used to perform image compression processing on the original image to obtain a target image for generating the target application.

[0096] Furthermore, the target application includes a plurality of program modules;

[0097] The device further comprises:

[0098] A resource merging module, configured to merge the image resources in the plurality of program modules;

[0099] The image attribute file generation module is used to compile the merged image resources and generate image attribute files corresponding to each image;

[0100] The initial resource package generation module is used to generate the initial resource package based on the image attribute file corresponding to each image.

[0101] Furthermore, the decompressed files include an initial resource file and an initial resource index file; the initial resource package decompression module 920 includes:

[0102] A target path determination module, configured to determine a target path where the original image is located based on the initial resource index file;

[0103] The original image extraction module is used to extract the original image from the target path.

[0104] Furthermore, the image compression module 930 includes:

[0105] An image compression command acquisition module is used to acquire an image compression command, wherein the image compression command includes image compression parameters; the image compression parameters are used to represent attribute information of the compressed image;

[0106] The compression processing module is used to perform image compression processing on the original image using the image compression command to obtain the target image corresponding to the image compression parameter.

[0107] Furthermore, the device further comprises:

[0108] A first updating module is configured to update the original image under the target path of the initial resource file to the target image, thereby obtaining a target resource file;

[0109] A second updating module is configured to update the initial resource index file based on the target image and the target path of the target image in the target resource file to obtain a target resource index file;

[0110] The target resource package generation module is configured to generate a target resource package based on the target resource file and the target resource index file.

[0111] Furthermore, the second update module includes:

[0112] An identification information determination module, configured to determine the identification information of the target image;

[0113] A corresponding relationship determination module, configured to construct a corresponding relationship between the target path where the target image is located and the identification information of the target image;

[0114] The third updating module is configured to update the initial resource index file based on the corresponding relationship to obtain the target resource index file.

[0115] Furthermore, the image compression module 930 includes:

[0116] A comparison module is used to compare the memory occupied by the compressed image with the preset compressed memory;

[0117] The target image determination module is configured to determine the compressed image as the target image when the memory occupied by the compressed image meets the preset compression memory.

[0118] The apparatus provided in the above embodiments can execute the method provided in any embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution of the method. For technical details not fully described in the above embodiments, please refer to the method provided in any embodiment of the present application.

[0119] This embodiment further provides a computer-readable storage medium, in which at least one instruction or at least one program is stored. The at least one instruction or at least one program is loaded by a processor and executed by any of the above methods of this embodiment.

[0120] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the methods described in the above embodiments.

[0121] Further, Figure 10 A schematic diagram of the hardware structure of a device for implementing the method provided in the embodiment of the present application is shown, and the device may participate in or include the apparatus provided in the embodiment of the present application. Figure 10 As shown, the device 10 may include one or more (illustrated as 102a, 102b, ..., 102n in the figure) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 10 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 10 More or fewer components than shown, or with Figure 10 Different configurations shown.

[0122] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the device 10 (or mobile device). As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0123] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the methods described in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the above-mentioned player preloading method or player operation method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the device 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0124] Transmission device 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of device 10. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.

[0125] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of device 10 (or mobile device).

[0126] Any of the above methods in this embodiment can be based on Figure 10 The device shown is implemented.

[0127] This specification provides method operation steps as described in the embodiments or flowcharts, but more or fewer operation steps may be included based on routine or non-creative work. The steps and order listed in the embodiments are only one way of executing the order of many steps and do not represent the only execution order. When an actual system or interrupt product is executed, it can be executed sequentially or in parallel according to the method shown in the embodiments or the drawings (for example, in a parallel processor or multi-threaded processing environment).

[0128] The structure shown in this embodiment is only a partial structure related to the scheme of the present application, and does not constitute a limitation on the device to which the scheme of the present application is applied. The specific device may include more or fewer components than shown, or combine certain components, or have different arrangements of components. It should be understood that the methods, devices, etc. disclosed in this embodiment can be implemented in other ways. For example, the device embodiment described above is only schematic. For example, the division of the modules is only a division of logical functions. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or unit modules.

[0129] Based on this understanding, the technical solution of this application, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes: a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program code.

[0130] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0131] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for image processing, characterized in that: include: Get the initial resource package corresponding to the target application; The initial resource package is generated based on compiling an initial resource file, wherein the initial resource file includes an original image corresponding to the target application; Decompressing the initial resource package and extracting the original image from the decompressed file; The decompressed files include the initial resource file and the initial resource index file; Extracting the original image from the decompressed file includes: Determine the target path of the original image based on the initial resource index file; Extracting the original image from the target path; The original image is compressed to obtain a target image for generating the target application.

2. The image processing method according to claim 1, wherein: The target application includes a plurality of program modules; The method further comprises: Merging the image resources in the multiple program modules; Compile the merged image resources and generate image attribute files corresponding to each image; The initial resource package is generated based on the image attribute file corresponding to each image.

3. The image processing method according to claim 1, wherein: The performing image compression processing on the original image to obtain a target image for generating the target application comprises: Obtaining an image compression command, wherein the image compression command includes image compression parameters; the image compression parameters are used to represent attribute information of the compressed image; The image compression command is used to perform image compression processing on the original image to obtain the target image corresponding to the image compression parameter.

4. The image processing method according to claim 1, wherein: The method further comprises: Updating the original image under the target path of the initial resource file to the target image to obtain a target resource file; Based on the target image and the target path of the target image in the target resource file, the initial resource index file is updated to obtain a target resource index file; A target resource package is generated based on the target resource file and the target resource index file.

5. The image processing method according to claim 4, characterized in that: The updating of the initial resource index file based on the target image and the target path of the target image in the target resource file to obtain the target resource index file includes: Determining identification information of the target image; Constructing a correspondence between the target path of the target image and the identification information of the target image; Based on the corresponding relationship, the initial resource index file is updated to obtain the target resource index file.

6. The image processing method according to claim 1, wherein: The performing image compression processing on the original image to obtain a target image for generating the target application comprises: Comparing the memory occupied by the original image and the compressed image; When the memory occupied by the original picture is greater than the memory occupied by the compressed picture, the compressed picture is determined as the target picture.

7. A picture processing device, characterized in that: include: An initial resource package acquisition module, used to acquire an initial resource package corresponding to a target application; The initial resource package is generated based on compiling an initial resource file, wherein the initial resource file includes an original image corresponding to the target application; An initial resource package decompression module, configured to decompress the initial resource package and extract the original image from the decompressed file; The decompressed files include the initial resource file and the initial resource index file, and the initial resource package decompression module includes: A target path determination module, configured to determine a target path where the original image is located based on the initial resource index file; An original picture extraction module, configured to extract the original picture from the target path; The image compression module is used to perform image compression processing on the original image to obtain a target image for generating the target application.

8. The device according to claim 7, characterized in that The target application includes a plurality of program modules; The device further comprises: A resource merging module, configured to merge the image resources in the plurality of program modules; The image attribute file generation module is used to compile the merged image resources and generate image attribute files corresponding to each image; The initial resource package generation module is used to generate the initial resource package based on the image attribute file corresponding to each image.

9. The device according to claim 7, characterized in that The image compression module includes: An image compression command acquisition module is used to acquire an image compression command, wherein the image compression command includes image compression parameters; the image compression parameters are used to represent attribute information of the compressed image; The compression processing module is used to perform image compression processing on the original image using the image compression command to obtain the target image corresponding to the image compression parameter.

10. The device according to claim 7, characterized in that The device further comprises: A first updating module is configured to update the original image under the target path of the initial resource file to the target image, thereby obtaining a target resource file; A second updating module is configured to update the initial resource index file based on the target image and the target path of the target image in the target resource file to obtain a target resource index file; The target resource package generation module is configured to generate a target resource package based on the target resource file and the target resource index file.

11. The device according to claim 10, characterized in that The second update module includes: An identification information determination module, configured to determine the identification information of the target image; A corresponding relationship determination module, configured to construct a corresponding relationship between the target path where the target image is located and the identification information of the target image; The third updating module is configured to update the initial resource index file based on the corresponding relationship to obtain the target resource index file.

12. The device according to claim 7, characterized in that The image compression module includes: A comparison module is used to compare the memory occupied by the compressed image with the preset compressed memory; The target image determination module is configured to determine the compressed image as the target image when the memory occupied by the compressed image meets the preset compression memory.

13. A picture processing device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the image processing method according to any one of claims 1 to 6.

14. A computer storage medium, characterized in that The storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded by the processor and executes the image processing method according to any one of claims 1 to 6.

15. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the image processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for generating application program installation package and electronic device

    CN108958755A

  • Software installation package obtaining method and device and electronic equipment

    CN109710265A