Image file optimization method and related equipment
Through the image file optimization method, the image file format is converted according to different conditions, which solves the problem of manual adjustment of image file size optimization in mobile device applications, and realizes the reduction of installation package volume and improvement of development efficiency.
Patent Information
- Application Number
- CN202210230296.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-03-10
AI Technical Summary
During the development of mobile device applications, developers need to manually adjust the image file format to reduce the size of the installation package, resulting in large workload and reducing development efficiency.
Provide an image file optimization method. By determining the target file path, obtaining the target image file, determining whether it meets the optimization conditions, and optimizing the image file according to different optimization conditions (such as transparent color, standard shape, solid color) and converting it into Join the image expert group, extended markup language or scalable vector graphics format to generate optimized image files.
Reduces the size of image files, reduces the volume of application installation packages, reduces the workload of developers, and improves development efficiency.
Smart Images

Figure CN114627197B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing, and in particular, relates to an image file optimization method and related equipment. Background Art
[0002] In the process of developing mobile device applications, due to the limitations of the storage capacity of mobile devices, it is often necessary to optimize and slim down the applications, that is, to reduce the size of the application installation package through certain adjustments and reduce the control space occupied by the application in the mobile device, so as to ensure the availability of the application.
[0003] In the process of optimizing the installation package, a more important task is to reduce the size of the image resource files in the installation package, thereby reducing the size of the entire installation package file. Common optimization methods include adjusting the format of the image files. In the actual work process, developers often need to manually adjust the image files.
[0004] Developers need to convert image files manually. This process requires manual retrieval of all resource files in the project and manual screening of resource files that need to be slimmed down. The workload of this process increases with the increase of image files, reducing the efficiency of the development process. Summary of the invention
[0005] The purpose of the present invention is to provide an image file optimization method, aiming to solve the problem that existing developers need to convert image files manually, resulting in excessive workload. The application provides:
[0006] A first aspect of an embodiment of the present application provides an image file optimization method, comprising:
[0007] Determine the target file path;
[0008] Get the target image file under the target file path;
[0009] Determining whether the target image file meets the optimization condition;
[0010] If the target image file meets the optimization condition, the target image file is optimized to obtain an optimized image file, and the file size of the optimized image file is smaller than the file size of the target image file.
[0011] Based on the image file optimization method provided in the first aspect of the embodiment of the present application, optionally,
[0012] The optimization conditions include a first optimization condition, a second optimization condition and a third optimization condition:
[0013] If the target image file meets the optimization condition, optimizing the target image file includes:
[0014] If the target image file meets the first optimization condition, performing a first optimization process on the target image file;
[0015] If the target image file meets the second optimization condition, performing a second optimization process on the target image file;
[0016] If the target image file meets the third optimization condition, the target image file is subjected to a third optimization process.
[0017] Based on the image file optimization method provided by the first aspect of the embodiment of the present application, optionally, the first optimization condition includes: the target image file has a transparent color value, and the transparent color value is a maximum value;
[0018] The first optimization process includes: converting the target image file into a Joint Photographic Experts Group format.
[0019] Based on the image file optimization method provided in the first aspect of the embodiment of the present application, optionally, the second optimization condition includes: the shape of the target image file is a standard shape, and the color of the target image file is a solid color or a gradient color;
[0020] The second optimization process includes: converting the target image file into an extended markup language format.
[0021] Based on the image file optimization method provided in the first aspect of the embodiment of the present application, optionally, the third optimization condition includes: the color of the target image file is a pure color, and the shape of the target image file meets the preset requirements;
[0022] The third optimization process includes: converting the target image file into a scalable vector graphics format.
[0023] Based on the image file optimization method provided in the first aspect of the embodiment of the present application, optionally, the method further includes:
[0024] Displaying relevant information of the target image file and the optimized image file, wherein the relevant information includes file size information and file name information of the target image file and the optimized image file;
[0025] The optimized image file is stored according to the user's selection.
[0026] Based on the image file optimization method provided in the first aspect of the embodiment of the present application, optionally, after optimizing the target image file to obtain the optimized image file, the method further includes:
[0027] Send optimization completion notification to the user.
[0028] A second aspect of an embodiment of the present application provides an image file optimization device, including:
[0029] A determination unit, used to determine a target file path;
[0030] An acquisition unit, used for acquiring a target image file under a target file path;
[0031] A judging unit, used to judge whether the target image file meets the optimization condition;
[0032] The optimization unit is used for optimizing the target image file to obtain an optimized image file if the target image file meets the optimization condition, wherein the file size of the optimized image file is smaller than the file size of the target image file.
[0033] A third aspect of the embodiment of the present application provides an image file optimization device, including:
[0034] CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply;
[0035] The memory is a short-term storage memory or a persistent storage memory;
[0036] The central processing unit is configured to communicate with the memory and execute instruction operations in the memory on the device to perform the method described in any one of the first aspects of the embodiments of the present application.
[0037] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute a method as described in any one of the first aspects of the embodiment of the present application.
[0038] A fifth aspect of the embodiments of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute a method as described in any one of the first aspects of the embodiments of the present application.
[0039] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: The present application provides an image file optimization method, including: determining a target file path; obtaining a target image file under the target file path; judging whether the target image file meets the optimization conditions; if the target image file meets the optimization conditions, optimizing the target image file to obtain an optimized image file, the file size of the optimized image file is smaller than the file size of the target image file. The above method makes the file size of the optimized image file finally obtained smaller, thereby reducing the size of the installation package of the application, meeting the needs of developers, reducing the work of developers, and improving the feasibility of the present method. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work. It is understood that the drawings provided in this section are only used to better understand the present solution and do not constitute a limitation of the present application.
[0041] Figure 1 A flowchart of an embodiment of the image file optimization method provided in this application.
[0042] Figure 2 Another flowchart diagram of an embodiment of the image file optimization method provided in this application.
[0043] Figure 3 A structural schematic diagram of an embodiment of the image file optimization device provided in this application.
[0044] Figure 4 This is another structural schematic diagram of an embodiment of the image file optimization device provided in this application. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application are clearly and completely described below. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should belong to the scope of protection of the present application. At the same time, for the sake of clarity and simplicity, the description of well-known functions and structures is omitted in the following description.
[0046] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present 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 described herein can be implemented in an order other than that 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, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0047] In the process of developing mobile device applications, due to the limitations of the storage capacity of mobile devices, it is often necessary to optimize and slim down the applications, that is, to reduce the size of the application installation package through certain adjustments and reduce the control space occupied by the application in the mobile device, so as to ensure the availability of the application.
[0048] In the process of optimizing the installation package, a more important task is to reduce the size of the image resource files in the installation package, thereby reducing the size of the entire installation package file. Common optimization methods include adjusting the format of the image files. In the actual work process, developers often need to manually adjust the image files.
[0049] Developers need to convert image files manually. This process requires manual retrieval of all resource files in the project and manual screening of resource files that need to be slimmed down. The workload of this process increases with the increase of image files, reducing the efficiency of the development process.
[0050] To solve the above problems, the present application provides a method for optimizing image files. Figure 1 , an embodiment of the image file optimization method provided in the present application includes: step 101-step 104.
[0051] 101. Determine the target file path.
[0052] Specifically, determine the target file path, which is the path address of the target image file. The user can determine the target file path by selecting a specific folder. The target file path can be the path of the application installation package, which is not limited here.
[0053] 102. Obtain the target image file under the target file path.
[0054] Specifically, the target image file under the target file path is obtained. The server scans the files under the target file path to obtain the target image file, wherein the format of the target image file is determined according to the user setting. The user can select a variety of different image file formats as conditions, and then obtain all image files under the target file path as the target image file. In the actual implementation process, the number of target image files is not limited. By obtaining image files of a variety of different formats, all image files under the target file path can be optimized as much as possible. It can be understood that in the actual implementation process, the user can also obtain the target image file under the target file path by setting certain screening conditions. Specifically, for example, all PNG (Portable Network Graphics) format files can be set as target image files. The specific form can be determined according to the actual situation and is not limited here.
[0055] 103. Determine whether the target image file meets optimization conditions.
[0056] Specifically, it is determined whether the target image file meets the optimization conditions. After obtaining the target image file, it is necessary to determine whether the target image file meets the optimization conditions. Specifically, the optimization conditions are pre-set by the user according to different optimization requirements. There can be multiple optimization conditions. If the target image file meets a certain optimization condition, it can be optimized according to the relevant settings of the optimization condition. The specific optimization conditions can be determined according to the actual situation and are not limited here.
[0057] 104. Optimize the target image file to obtain an optimized image file.
[0058] Specifically, the target image file is optimized to obtain an optimized image file, and the file size of the optimized image file is smaller than the file size of the target image file. That is, the target image file is optimized to reduce the file size of the target image file. The optimized image file is a processed file, and the file size is smaller than the original target image file. The optimization processing means used in the actual implementation process may include: converting the original file into a file format with a smaller volume. The specific means may be determined according to the actual situation and are not limited here. The optimized image file obtained after the optimization process reduces the volume occupied by the image while maintaining the information of the original target image file as much as possible.
[0059] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: The present application provides an image file optimization method, including: determining a target file path; obtaining a target image file under the target file path; judging whether the target image file meets the optimization conditions; if the target image file meets the optimization conditions, optimizing the target image file to obtain an optimized image file, the file size of the optimized image file is smaller than the file size of the target image file. The above method makes the file size of the optimized image file finally obtained smaller, thereby reducing the size of the installation package of the application, meeting the needs of developers, reducing the work of developers, and improving the feasibility of the present method.
[0060] To facilitate the use of this method in actual processes, the present application also provides a more detailed embodiment that can be optionally implemented, please refer to Figure 2 An embodiment of the image file optimization method provided in the present application includes: steps 201 to 209.
[0061] 201. Determine the target file path.
[0062] 202. Obtain a target image file under a target file path.
[0063] Specifically, the above steps 201 to 202 are the same as the above Figure 1 The contents of step 101 and step 102 in the corresponding embodiment are similar, and the details can be referred to the aforementioned contents, which will not be repeated here.
[0064] 203. Determine whether the target image file meets the optimization condition.
[0065] Specifically, it is determined whether the target image file meets the optimization condition. Specifically, this embodiment is described by taking the optimization condition including the first optimization condition, the second optimization condition and the third optimization condition as an example. Specifically,
[0066] The first optimization condition includes: the target image file has a transparent color value, and the transparent color values are all maximum values; wherein the target image file has a transparent color value, which means that the target image file is a PNG format file, and the PNG format file has a transparent color value setting in addition to the three conventional color value attributes, and the transparent color value is used to indicate the transparency of the image. If the transparent color values of the target image file are all maximum values, it means that the PNG image is a completely opaque image, that is, the transparent color value attribute does not work, and therefore the image can be converted into an image format without a transparent color value, thereby reducing the amount of data.
[0067] The second optimization condition includes: the shape of the target image file is a standard shape, and the color of the target image file is a solid color or a gradient color. This form of image indicates that the image form is relatively simple and a more concise form can be used to represent the image.
[0068] The third optimization condition includes: the color of the target image file is a pure color, and the shape of the target image file meets the preset requirements. The shape of the preset requirements under this condition can be some conventional graphics, such as arrows, phones, text messages, bubbles, etc., which are not limited here. The image that has been driven can be slimmed down in svg format.
[0069] In the actual implementation process, the pure color, gradient color, transparency, image size, complexity and other information of all target images can be extracted and compared one by one to determine the conditions met by each image. It is understandable that some images may meet two conditions at the same time. At this time, the priority of different conditions can be determined, and the processing method corresponding to the condition with the higher priority can be used for processing. The specific priority setting is not limited here.
[0070] 204. Convert the target image file into a Joint Photographic Experts Group format.
[0071] Specifically, if the target image file meets the first optimization condition, the target image file is converted into a Joint Photographic Experts Group (JPG) format.
[0072] 205. Convert the target image file into an extended markup language format.
[0073] Specifically, if the target image file meets the second optimization condition, the target image file is converted into an extended markup language (xml) format.
[0074] 206. Convert the target image file into a scalable vector graphics format
[0075] Specifically, if the target image file meets the second optimization condition, the target image file is converted into a scalable vector graphics (svg) format.
[0076] 207. Display relevant information of the target image file and the optimized image file.
[0077] Specifically, the relevant information of the target image file and the optimized image file is displayed. After the conversion of the target image file is completed, the relevant information of the target image file and the optimized image file can be displayed, wherein the relevant information includes the file size information and file name information of the target image file and the optimized image file, so that the user can compare the size change of the image before and after optimization, and then learn the relevant information of the optimization process.
[0078] 208. Store the optimized image file according to user selection.
[0079] Specifically, the optimized image file is stored according to the user's choice. The user can choose to store the optimized image file in an additionally selected folder, or store it in the target file path to replace the original target image file. The specific choice can be determined according to the user's choice and is not limited here.
[0080] 209. Send optimization completion notification to the user.
[0081] Specifically, a notification of optimization completion is sent to the user. The tool can be configured with a hook function, and after the scan is completed, the user can be informed of the optimization results through IM notification, email notification, or SMS notification; at the same time, each optimization record is recorded, and backup or restoration can be performed based on the record.
[0082] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: The present application provides an image file optimization method, including: determining a target file path; obtaining a target image file under the target file path; judging whether the target image file meets the optimization conditions; if the target image file meets the optimization conditions, optimizing the target image file to obtain an optimized image file, the file size of the optimized image file is smaller than the file size of the target image file. The above method makes the file size of the optimized image file finally obtained smaller, thereby reducing the size of the installation package of the application, meeting the needs of developers, reducing the work of developers, and improving the feasibility of the present method.
[0083] The above content describes the image file optimization method provided by the present application. To support the implementation of the above embodiment, the present application also provides an image file optimization device. Figure 3 , an embodiment of the present application includes:
[0084] A determination unit 301 is used to determine a target file path;
[0085] An acquisition unit 302 is used to acquire a target image file under a target file path;
[0086] A judging unit 303 is used to judge whether the target image file meets the optimization condition;
[0087] The optimization unit 304 is configured to optimize the target image file to obtain an optimized image file if the target image file meets the optimization condition.
[0088] In this embodiment, the process performed by each unit in the image file optimization device is the same as the above Figure 1 or Figure 2 The method flow described in the corresponding embodiment is similar and will not be repeated here.
[0089] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0090] like Figure 4As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0091] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0092] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as the image file optimization method. For example, in some embodiments, it may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the image file optimization method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the image file optimization method in any other appropriate manner (e.g., by means of firmware).
[0093] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0094] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0095] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0096] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0097] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0098] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0099] The embodiment of the present application also provides a computer storage medium, which is used to store computer software instructions used for the above-mentioned image file optimization method, and includes a program designed for executing the image file optimization method.
[0100] The image file optimization method can be as described above Figure 1 The image file optimization method described in .
[0101] The present application also provides a computer program product, which includes computer software instructions, which can be loaded by a processor to implement the above Figure 1 Figure 2 The process of any one of the image file optimization methods.
[0102] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the equivalent transformation of the circuit, the division of the unit, is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, 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 units, which can be electrical, mechanical or other forms.
[0103] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0104] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0105] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent substitution or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for optimizing an image file, characterized in that: include: Determine the target file path; Get the target image file under the target file path; Determining whether the target image file meets the optimization condition; If the target image file meets the optimization condition, the target image file is optimized to obtain an optimized image file, the file size of the optimized image file is smaller than the file size of the target image file; The optimization conditions include a first optimization condition, a second optimization condition and a third optimization condition: If the target image file meets the optimization condition, optimizing the target image file includes: If the target image file meets the first optimization condition, performing a first optimization process on the target image file; If the target image file meets the second optimization condition, performing a second optimization process on the target image file; If the target image file meets the third optimization condition, performing a third optimization process on the target image file; The first optimization condition includes: the target image file has transparent color values, and the transparent color values are all maximum values; The first optimization process includes: converting the target image file into a Joint Photographic Experts Group format; The second optimization condition includes: the shape of the target image file is a standard shape, and the color of the target image file is a solid color or a gradient color; The second optimization process includes: converting the target image file into an extended markup language format; The third optimization condition includes: the color of the target image file is a pure color, and the shape of the target image file meets the preset requirements; The third optimization process includes: converting the target image file into a scalable vector graphics format.
2. The image file optimization method according to claim 1, characterized in that: The method further comprises: Displaying relevant information of the target image file and the optimized image file, wherein the relevant information includes file size information and file name information of the target image file and the optimized image file; The optimized image file is stored according to the user's selection.
3. The image file optimization method according to claim 1, characterized in that: After the target image file is optimized to obtain the optimized image file, the method further includes: Send optimization completion notification to the user.
4. An image file optimization device, characterized in that: include: A determination unit, used to determine a target file path; An acquisition unit, used for acquiring a target image file under a target file path; A judging unit, used to judge whether the target image file meets the optimization condition; an optimization unit, configured to optimize the target image file to obtain an optimized image file if the target image file meets the optimization condition, wherein the file size of the optimized image file is smaller than the file size of the target image file; The optimization conditions include a first optimization condition, a second optimization condition and a third optimization condition: If the target image file meets the optimization condition, optimizing the target image file includes: If the target image file meets the first optimization condition, performing a first optimization process on the target image file; If the target image file meets the second optimization condition, performing a second optimization process on the target image file; If the target image file meets the third optimization condition, performing a third optimization process on the target image file; The first optimization condition includes: the target image file has transparent color values, and the transparent color values are all maximum values; The first optimization process includes: converting the target image file into a Joint Photographic Experts Group format; The second optimization condition includes: the shape of the target image file is a standard shape, and the color of the target image file is a solid color or a gradient color; The second optimization process includes: converting the target image file into an extended markup language format; The third optimization condition includes: the color of the target image file is a pure color, and the shape of the target image file meets the preset requirements; The third optimization process includes: converting the target image file into a scalable vector graphics format.
5. An image file optimization device, characterized in that: include: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory, and execute instructions in the memory on the image file optimization device to perform the image file optimization method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Method and device for generating application installation package, computer equipment and storage medium
CN114138290A