A method for image processing and related equipment
By encoding the original image files into smaller files and generating pseudo-files, the problem of large storage space in the JPEG standard is solved, achieving ecological compatibility and storage space optimization that is imperceptible to users.
Patent Information
- Application Number
- CN202210264533.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-17
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2042-03-17
AI Technical Summary
Image files based on the existing JPEG standard take up a lot of storage space, and the new standard's ecosystem compatibility issues limit its adoption. Insufficient storage space has become one of the main factors for users to replace their mobile phones.
The original image file is encoded into a smaller image file, and a pseudo file is generated to replace the original file. A correspondence is established between the pseudo file and the encoded image file to ensure ecosystem compatibility and seamless access.
While ensuring ecosystem compatibility, it reduces image storage space and improves storage space utilization efficiency, resulting in a seamless user experience.
Smart Images

Figure CN116800877B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more particularly to a method for processing images and related equipment. Background Technology
[0002] With the popularity of smartphones and other mobile devices, media files (especially images) generally account for a high proportion of storage space on existing smartphones and cloud storage. Furthermore, as camera pixels continue to increase, image resolution is rising, and each photo occupies increasingly larger storage spaces. Currently, insufficient storage space has become one of the main factors driving users to upgrade their phones. Reducing the storage space required for images and improving storage space utilization efficiency can greatly enhance user experience and user stickiness.
[0003] JPEG (Joint Photographic Experts Group) is currently the most widely used image standard (image format). However, the JPEG standard is relatively old (over 20 years old) and requires a large amount of storage space, more than twice the storage space of subsequent new image standards. Although new image standards continue to emerge, they have problems such as ecosystem compatibility, which limits their promotion and slows down their development. As a result, most users have not been able to enjoy the benefits brought by the new image standards and still use the JPEG standard.
[0004] Therefore, how to reduce image storage space while ensuring ecological compatibility has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides an image processing method and computer device. The method encodes the original image file into a smaller image file, saving storage space. A pseudo-file is generated based on the original and encoded image files, and this pseudo-file replaces the original image file to ensure ecosystem compatibility and adaptability to various applications. Simultaneously, a correspondence is established between the pseudo-file and the encoded image file, allowing the original image file to be decoded using the pseudo-file and the encoded image file when accessing the image, without affecting its normal use. This method reduces image storage space while maintaining ecosystem compatibility and is seamless for application processing.
[0006] Based on this, the embodiments of this application provide the following technical solutions:
[0007] Firstly, this application provides an image processing method (encoding process) applicable to image processing on both the device and cloud sides. The method includes: encoding a first image file into a second image file requiring less storage space; reducing storage space by changing the format of the first image file during encoding (i.e., the first and second image files have different file formats, and the second image file requires less storage space than the first image file); generating a pseudo-file based on the filename and format of the first image file, the pseudo-file having the same filename and format as the first image file; and establishing a correspondence between the pseudo-file and the encoded second image file, enabling the system to locate the second image file through the pseudo-file. The pseudo-file and the second image file replace the first image file and are stored in a memory.
[0008] It should be understood that when the entire image processing flow involves at least two devices, such as an edge device and a cloud device, the image processing method may be implemented in one possible way. In one possible implementation, the image processing method may also include saving the pseudo-file and the second image file; that is, the action of saving the files and the action of image processing are performed by the same device. In another possible implementation, the image processing method may be performed by one device, while the step of saving the pseudo-file and the second image file is performed by the other device. In this case, the image processing method may also include sending the pseudo-file and the second image file to the other device for storage.
[0009] It should be understood that the above image processing method can adopt any encoding method or encoding format that can achieve the above effect. That is, this application does not limit the encoding method and the format of the second image file, as long as the storage space required by the second image file is less than the storage space required by the first image file. The smaller the storage space required by the second image file, the higher the efficiency of the above image processing method and the more obvious the beneficial effect.
[0010] It should be understood that the above image processing method can establish the correspondence between the pseudo file and the second image file in any way, as long as the system can find the second image file through the pseudo file. The specific implementation of the correspondence is not limited in the embodiments of this application.
[0011] The image processing method described above encodes the first image file into a second image file that requires less storage space, thus saving the storage space needed to save the first image file. A pseudo-file is generated based on the first and second image files, replacing the first image file with a pseudo-file of the same name and format. This ensures seamless integration with the application, maintains ecosystem compatibility, and adapts to various application software. Simultaneously, a correspondence is established between the pseudo-file and the second image file, allowing the pseudo-file to locate the second image file and decode the first image file when needed, without affecting normal image usage and ensuring a seamless user experience. This method reduces image storage space while maintaining ecosystem compatibility and achieving a seamless experience for both the application and the user.
[0012] In one possible implementation of the first aspect, when it is necessary to access the first image file, for example, to edit, view, or send the first image file, the pseudo file can be obtained based on the request information for obtaining the first image file (which includes the file name and file format of the file to be obtained), and then the second image file can be obtained based on the correspondence between the pseudo file and the second image file, and the first image file can be obtained by decoding based on the second image file.
[0013] Through the above mechanism, the association between the pseudo file and the first image file, as well as the association between the pseudo file and the second image file, is established, so that when the first image file needs to be accessed, it can be quickly recovered, ensuring the normal access and use of the first image file.
[0014] In one possible implementation of the first aspect, a lossless encoding method is used in the process of encoding the first image file into the second image file.
[0015] Lossless encoding does not cause any loss of image file quality. After decoding the second image file, the first image file can be recovered. Moreover, the recovered first image file has almost no quality loss compared with the original first image file. It can save storage space while ensuring user experience, so that users can not feel the difference.
[0016] In one possible implementation of the first aspect, the pseudo file and the second image file are two separate files, and the pseudo file includes the filename and storage path of the second image file.
[0017] It should be understood that the pseudo file can also include more information about the second image file, such as the file format and file size of the second image file, in order to more accurately locate the second image file.
[0018] Saving the pseudo file and the second image file as two separate files can reduce the difficulty of algorithm implementation. In this case, by saving the filename and storage path of the second image file in the pseudo file, the second image file can be located through the pseudo file.
[0019] In one possible implementation of the first aspect, the pseudo file contains the second image file, that is, the second image file is stored in the pseudo file, and the pseudo file also includes the storage path of the second image file, for example, the starting byte of the second image file in the pseudo file.
[0020] Saving the pseudo file and the second image file into a single file, i.e., saving the second image file in the pseudo file, can reduce the complexity of system file management. Furthermore, since the second image file can be located directly by searching the pseudo file when accessing the first image file, there is no need to access other files, which can improve access efficiency.
[0021] In one possible implementation of the first aspect, the first image file is obtained by taking a picture with a camera; or, the first image file is obtained by receiving it through an application; or, the first image file is obtained from memory.
[0022] The image processing method described above can save storage space for the first image file, and this image processing process can be applied to various stages as needed.
[0023] In one possible implementation of the first aspect, the first image file may be in JPEG, PNG, or GIF format.
[0024] In one possible implementation of the first aspect, the first image file is an image file stored in memory that is accessed less frequently than a preset value, for example, once a week, once a month, or once a year.
[0025] Encoding the first image file to save storage space, and then decoding it only when needed, requires a certain amount of computing power. If the first image file is accessed frequently, the continuous encoding and decoding process will consume a lot of computing power. Therefore, selecting image files with access frequencies lower than a preset value for processing can achieve a balance between storage space and system computing power, ensuring a better user experience to the greatest extent.
[0026] Secondly, embodiments of this application provide an image processing method (decoding process) for accessing image files, applicable to both edge devices and cloud devices. The method includes: in response to a request for obtaining a first image file, the request information including the filename and file format of the first image file; obtaining a pseudo file with the same filename and file format as the first image file; obtaining a second image file corresponding to the pseudo file based on the pseudo file; and decoding the second image file into the first image file, wherein the first image file and the second image file have different formats, and the second image file requires less storage space than the first image file.
[0027] It should be understood that the image processing method provided in the second aspect corresponds to the image processing method provided in the first aspect. The image processing method provided in the first aspect is used to encode the original image file (the first image file) to save storage space, while the image processing method provided in the second aspect is used to perform decoding operations to restore the original image file when it is necessary to access the original image file.
[0028] By using the image processing method described above, the association between the pseudo file and the first image file, as well as the association between the pseudo file and the second image file, is guaranteed. This ensures that the first image file can be quickly recovered when it needs to be accessed, thus guaranteeing normal access and use of the first image file.
[0029] In one possible implementation of the second aspect, the pseudo file and the second image file are two separate files, and the pseudo file includes the filename and storage path of the second image file.
[0030] In one possible implementation of the second aspect, the pseudo file contains the second image file, that is, the second image file is stored in the pseudo file, and the pseudo file also includes the storage path of the second image file, for example, the starting byte of the pseudo file from which the second image file begins.
[0031] In one possible implementation of the second aspect, the first image file may be in JPEG, PNG, or GIF format.
[0032] A third aspect of this application provides a computer device that has the function of implementing the methods described in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software package...
[0033] It includes one or more modules corresponding to the functions mentioned above.
[0034] A fourth aspect of this application provides a computer device that may include a memory, a processor, and a bus system. The memory is used to store a program, and the processor is used to call the program stored in the memory to execute the method of the first aspect of this application or any possible implementation of the first aspect.
[0035] A fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, enable the computer to perform the methods described in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0036] The fifth aspect of this application provides a computer program that, when run on a computer, causes the computer to execute the methods described in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0037] A sixth aspect of this application provides a chip (e.g., a CPU) including at least one processor and at least one interface circuit coupled to the processor. The at least one interface circuit performs transceiver functions and sends instructions to the at least one processor. The at least one processor runs computer programs or instructions and has the functionality to implement the methods described in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect. This functionality can be implemented in hardware, software, or a combination of hardware and software, and the hardware or software includes one or more modules corresponding to the above-described functions. Furthermore, the interface circuit is used to communicate with other modules outside the chip. For example, the interface circuit can send pseudo-files and second image files obtained by the processor on the chip to another device for storage.
[0038] The second to sixth aspects of the embodiments of this application can achieve the beneficial effects described in the first aspect, and will not be repeated here to avoid repetition. Attached Figure Description
[0039] Figure 1 A storage system architecture diagram provided for an embodiment of this application;
[0040] Figure 2 A flowchart illustrating the image processing method provided in this application embodiment;
[0041] Figure 3a This is a schematic diagram illustrating a storage method provided in an embodiment of this application;
[0042] Figure 3b This is a schematic diagram illustrating another storage method provided in an embodiment of this application;
[0043] Figure 4 A flowchart illustrating the image processing method provided in this application embodiment;
[0044] Figure 5 A schematic diagram of the control interface provided in the embodiments of this application;
[0045] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this application;
[0046] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application;
[0047] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0048] The embodiments of the present invention will now be described with reference to the accompanying drawings. In the following description, specific aspects of the embodiments of the present invention are illustrated in the drawings, or specific aspects of the embodiments of the present invention may be used. It should be understood that the embodiments of the present invention can be used in other aspects and may include structural or logical variations not depicted in the drawings. Therefore, the following detailed description should not be construed in a limiting sense, and the scope of the invention is defined by the appended claims. For example, it should be understood that the disclosure of the described method is equally applicable to corresponding devices or systems for performing the method, and vice versa. For example, if one or more specific method steps are described, the corresponding device may include one or more units, such as functional units, to perform the described one or more method steps (e.g., one unit performs one or more steps, or multiple units, each performing one or more of the multiple steps), even if such one or more units are not explicitly described or illustrated in the drawings. On the other hand, for example, if a specific apparatus is described based on one or more units, such as functional units, the corresponding method may include a step to perform the functionality of one or more units (e.g., one step performs the functionality of one or more units, or multiple steps, each performing the functionality of one or more of the multiple units), even if such one or more steps are not explicitly described or illustrated in the drawings. Furthermore, it should be understood that, unless otherwise expressly stated, the features of the various exemplary embodiments and / or aspects described herein may be combined with each other.
[0049] In this embodiment of the invention, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0050] The terminology used in the embodiments section of this invention is for the purpose of explaining specific embodiments of the invention only, and is not intended to limit the invention.
[0051] First, the application scenarios involved in the image processing method provided in this application embodiment are introduced. In one possible implementation, the image processing method provided in this application embodiment can be executed on the device side. For example, the original image file can be obtained through an application such as a camera or a social app, the operating system on the device side encodes the original image file, generates an encoded image file and a pseudo file, and stores the encoded image file and pseudo file in the device side's memory to save storage space on the device side. In one possible implementation, the image processing method provided in this application embodiment can be executed on the cloud side. For example, when the device side sends the original image file to the cloud side for storage, the processor on the cloud side can encode the original image file, generate an encoded image file and a pseudo file, and store the encoded image file and pseudo file to save cloud space. In one possible implementation, the image processing method provided in this application embodiment can be executed collaboratively between the device and the cloud. For example, when the client needs to send an image file to the cloud for storage, the client's operating system can encode the original image file and generate an encoded image file and a pseudo file. The encoded image file and pseudo file are then sent to the cloud for storage, thus saving cloud space. In one possible implementation, the image processing method provided in this application can be applied to a home storage scenario. In this case, home storage corresponds to the aforementioned cloud-side storage, and the method is similar and will not be described in detail here.
[0052] Secondly, the system architecture provided in the embodiments of this application will be described. Please refer to [link / reference] for details. Figure 1 , Figure 1 This is a storage system architecture diagram provided for an embodiment of the present invention. Figure 1As shown, the storage system includes compute nodes 11, storage nodes 12, and storage media 13. The compute nodes 11 and storage nodes 12 can be physical servers, or virtual entities based on general-purpose hardware resource abstractions, such as virtual machines or containers. The storage media 13 can be, for example, a solid-state drive (SSD), a hard disk drive (HDD), or storage class memory (SCM). Furthermore, the storage media 13 can be a local storage medium on the storage nodes or a distributed storage medium connected to the storage nodes.
[0053] Computing node 11 can access data from storage node 12, such as writing and reading data. Specifically, computing node 11 can send a write request to storage node 12 to write data. The data to be written can be various types of data, such as images, databases, and text. In this embodiment, the data to be written is the original image file (first image file). After receiving the write request, storage node 12 encodes the first image file into an image file with a smaller required storage space, i.e., a second image file, using encoding module 121. Pseudo-file generation module 123 generates a pseudo-file based on the first image file received by storage node 12 and the second image file encoded by encoding module 121. Storage node 12 may also include a decoding module 122. When computing node 11 needs to read the original image file (first image file), storage node 12 can find the encoded second image file from storage medium 13 according to the pseudo-file and read the encoded second image file. Decoding module 122 is used to decode the encoded second image file to recover the first image file and return the obtained first image file to computing node 11. The aforementioned encoding module 121, pseudo-file generation module 123, and decoding module 122 can be in the form of software, hardware, or firmware.
[0054] Based on the system architecture described above, the image processing method provided in this application embodiment will be described in detail below. This image processing method can be used in the various application scenarios mentioned above. Here, only the terminal side is described in detail. It should be understood that it can also be used in other application scenarios, and the method is basically the same. Please refer to [link to specific details]. Figure 2 , Figure 2 A flowchart illustrating the image processing method provided in this application embodiment may specifically include the following steps:
[0055] 201. Encode the first image file into a second image file. The format of the first image file is different from that of the second image file, and the storage space required for the second image file is less than that required for the first image file.
[0056] It should be understood that the image processing method provided in this application embodiment is used to reduce the storage space required to store images. Therefore, image files can be processed at various stages. In one possible implementation, the image file can be processed when it is first generated or received, for example, after the image file is captured by a camera, or after the image file is received by an application. In another possible implementation, image files already stored in memory can be processed, for example, this operation can be performed periodically. In this case, the image file can be retrieved from memory, processed, and then stored back in memory. It should be understood that the above time points are merely exemplary, and other time points for encoding and processing images are possible. In actual operation, an appropriate time point can be selected according to the requirements.
[0057] Specifically, encoding image files requires decoding to obtain the original image file, which increases operational complexity, system computational power, and reduces image acquisition efficiency. Therefore, one possible implementation involves periodically processing image files accessed less frequently than a preset value, while saving frequently accessed image files as their original form, thus achieving a balance between storage space and operational efficiency. For example, the preset value could be once a month, once a quarter, or once a year, etc., and this application does not impose any limitations on this.
[0058] The first image described in this embodiment can be in the format of common standard image formats such as JPEG, PNG (Portable Network Graphics), and GIF (Graphics Interchange Format). These standard image formats are universal, and most ecosystems can support images in these formats, resulting in good ecosystem compatibility. The second image described in this embodiment can be in the format of any image that can reduce the storage space required to store the image. It is not limited to common image formats, but can also be a proprietary format. For example, the second format can be HEIF (High Efficiency Image Format). It should be understood that in this embodiment, the first image file is encoded into a second image file to reduce the storage space required to store the image file. Therefore, any two image formats that meet the constraint that the storage space required by the second image format is less than that required by the first image format are possible, and any encoding algorithm that can achieve this effect is possible. This embodiment does not limit the specific formats of the first and second image files or the encoding algorithms used.
[0059] It should be understood that the greater the compression gain of the encoding algorithm used, the smaller the storage space required for the encoded image file, thus saving more storage space. Therefore, while ensuring the quality of the image file, the encoding algorithm with the greatest compression gain should be preferred. For example, an encoding algorithm with a compression gain of 20%+ (the file size of the encoded image file is reduced by 20%+ compared to the original image file) can be selected.
[0060] It is important to note that existing technologies typically refer to the process of encoding image files from bitmap format to formats such as JPEG as primary encoding. For example, the original image captured by a camera is usually in bitmap format, and existing technologies usually first encode the bitmap image file into a format such as JPEG before storing it. Since bitmap image files require a large amount of storage space, the aforementioned primary encoding process can also save storage space. In the embodiments of this application, encoding the first image file into the second image file is not a primary encoding process, but a secondary encoding process performed after the primary encoding. That is, in the embodiments of this application, the format of the first image file is not bitmap, but an image format such as JPEG that has undergone primary encoding.
[0061] In one possible implementation, the encoding process of converting the first image into the second image is lossless encoding. During decoding, the second image file can be restored to the first image file through decoding operations. Using a lossless encoding method ensures that the decoded first image file shows almost no loss compared to the original image file, guaranteeing a good user experience and making it seamless for the user. For example, this lossless encoding method can be visually lossless, meaning that the first image file restored from the second image file shows no visual loss compared to the original first image file, and the user will not perceive any difference between the decoded and original first image files. For example, this lossless encoding method can be bit-lossless, meaning that the first image file restored from the second image file has the same bitrate as the original first image file. It should be understood that the above lossless encoding methods are merely exemplary, and other lossless encoding methods that can guarantee a good user experience are possible.
[0062] 202. Generate a pseudo file based on the first image file and the second image file. The pseudo file has the same format and filename as the first image file. The pseudo file has a corresponding relationship with the second image file. The pseudo file and the second image file are used to save in the memory.
[0063] In existing technology, if the first image file is directly stored, the system records information such as the filename, format, and storage path of the first image file. When the first image file needs to be accessed, it can be located using this information. After encoding the first image file to obtain the second image file, because the format of the second image file is different from that of the first image file, it may be impossible to directly find the second image file when accessing the first image. Therefore, a pseudo-file needs to be generated as a bridge between the system and the second image file.
[0064] The pseudo-file has the same filename and format as the first image file. Therefore, it can be used to replace the first image file, and the application will recognize it as the first image file. Thus, when calling the first image file, it will locate the pseudo-file based on its filename and format. Simultaneously, a correspondence needs to be established between the pseudo-file and the second image file. This ensures that when the system locates the pseudo-file based on its filename and format, it will further point to the second image file, allowing the system to obtain the actual content of the first image file (i.e., the second image file) through the pseudo-file.
[0065] In one possible implementation, the pseudo file may also contain a pseudo file identifier, which indicates that the pseudo file is a dummy file and not the real first image file, in order to prevent the system from directly treating the pseudo file as the first image file when it finds it.
[0066] After obtaining the pseudo file and the second image file, the pseudo file and the second image file can be saved in the memory to replace the first image file. Since the storage space required by the pseudo file and the second image file is much smaller than that of the first image file, storing only the pseudo file and the second image file without storing the first image file can greatly save storage space.
[0067] This application does not limit the specific storage method of the pseudo file and the second image file. In one possible implementation, the pseudo file and the second image file can be stored as two independent files. For example, Figure 3a As shown, the first image file is named A1 and is in JPEG format. The format and filename of the second image file obtained by encoding the first image file can be arbitrary, as long as the storage space required for the second image file is less than that of the first image file. A pseudo file is named A1 and is in JPEG format. To enable the system to locate the second image file through this pseudo file, it includes the filename and storage path of the second image. This implementation method is relatively easy to implement, reducing the complexity of algorithm implementation.
[0068] In another possible implementation, the pseudo file can contain the second image file. The second image file is stored simultaneously with the pseudo file. For example, as shown... Figure 3b As shown, the entire pseudo-file is named A1, and its format is JPEG. The pseudo-file consists of two parts: a second image file and a pseudo-file header. The pseudo-file header includes the storage path of the second image file. Since the pseudo-file includes the second image file, its storage path can be used to indicate from which byte in the pseudo-file the second image file begins. Both implementation methods achieve the desired effect: the system finds the pseudo-file through its filename and format, and then locates the second image file using the relevant information within the pseudo-file. This implementation method saves only one pseudo-file, reducing the complexity of the file management system and improving its efficiency.
[0069] It should be noted that the entities responsible for saving the pseudo file and the second image file may differ in different application scenarios. In one possible implementation, the image processing method is executed on the client side, and the saving action is also performed on the client side. In another possible implementation, the image processing method is executed on the cloud side, and the saving action is also performed on the cloud side. In yet another possible implementation, the image processing method may involve client-cloud collaboration, or collaboration between two client sides. In this case, steps 201 and 202 may be executed by the client side (or one of them), after which the client side sends the pseudo file and the second image file to the cloud side (or the other side) for storage.
[0070] In one possible implementation, after obtaining the first image file, the first image file is first stored in the cache, and then the image processing method described above is executed. After saving the pseudo file and the second image file, the first image file can be cleared from the cache (i.e., the cache is released) to save cache space.
[0071] When the system needs to retrieve the first image file again, for example, when it needs to edit the first image file, it needs to recover the first image file using a pseudo file and a second image file. Please refer to [link / reference] for details. Figure 4 , Figure 4 A flowchart illustrating the image processing method provided in this application embodiment may specifically include the following steps:
[0072] 401. In response to the request information for obtaining the first image file, obtain a pseudo file. The request information includes the filename and format of the first image file, and the filename and format of the pseudo file are the same as those of the first image file.
[0073] When a user needs to open, send, or edit an image file, the relevant application needs to send a request to retrieve the first image file and then perform the corresponding operation. To retrieve the first image file, the request information needs to include the filename and format of the first image file for locating the first image information. Because the pseudo-file has the same filename and format as the first image file, the system will mistakenly identify the pseudo-file as the requested first image file and thus retrieve the pseudo-file.
[0074] 402. Based on the pseudo file, obtain the second image file. The pseudo file and the second image file have a corresponding relationship.
[0075] The pseudo-file includes a pseudo-file identifier. Therefore, when the system reads the information in the pseudo-file, it will know that the pseudo-file is not the first image file to be obtained, but a dummy file. At this point, the system can obtain the second image file based on the correspondence between the pseudo-file and the second image file.
[0076] 403. Decode the second image file into the first image file. The first image file and the second image file have different formats. The storage space required for the second image file is less than that required for the first image file.
[0077] After obtaining the second image file, a decoding method corresponding to the above encoding method can be used to decode the second image file into the first image file, thereby restoring the first image file and enabling the system to successfully obtain the first image file required in the request information.
[0078] After obtaining the first image file, operations can be performed on it according to the request. Once the operations on the first image file are complete, the closing process can begin. In one possible implementation, different closing procedures may need to be executed depending on the operation. For example, if only the first image file is displayed without modification, neither the pseudo file nor the second image file needs modification; in this case, the first image file can be directly deleted from the cache (release the cache). If the first image file is edited, the pseudo file and / or the second image file need to be regenerated based on the edited first image file, and then the first image file is deleted from the cache (release the cache).
[0079] It should be understood that, such as Figure 4 The image processing method shown is partially implemented similarly to... Figure 2 The image processing methods shown are the same or similar, and will not be repeated here to avoid repetition.
[0080] The image processing method provided in this application encodes the original image file into an image file with a smaller storage space, thus saving storage space required to save the image. A pseudo-file is generated based on the original image file and the encoded image file, and this pseudo-file replaces the original image file to ensure ecosystem compatibility and adaptability to various application software. Simultaneously, a correspondence is established between the pseudo-file and the encoded image file, so that when accessing the image, the original image file can be decoded using the pseudo-file and the encoded image file, without affecting the normal use of the image. This method can reduce image storage space while ensuring ecosystem compatibility and is seamlessly integrated into applications.
[0081] In one possible implementation, the image processing method described above can be a function of a computer device, which can be configured via a switch in the settings. For example, this function could be a new feature that prompts the user during a system upgrade. An exemplary control interface for this function would look like this: Figure 5 As shown, users can control the function to be turned on or off using this switch.
[0082] Based on the corresponding embodiments described above, in order to better implement the above-described solutions of this application, a computer device for implementing the above solutions is also provided below. This computer device may include handheld terminal devices, such as mobile phones, computers, iPads, etc., and may also include smart wearable devices, such as smart bracelets, smartwatches, smart heart rate monitors, etc.; it may also include wheeled mobile devices, such as vehicles (e.g., autonomous vehicles), aircraft, robots (e.g., robotic vacuum cleaners), etc. Specifically, this application does not limit the product form of the computer device; any electronic device that can be used to implement the image processing method described in this application can be called a computer device.
[0083] Please see Figure 6 , Figure 6 This is a schematic diagram of a computer device provided in an embodiment of this application. The computer device 600 includes an encoding / decoding module 601 and a generation module 602. The acquisition module 601 is used to encode a first image file into a second image file. The format of the first image file is different from that of the second image file, and the storage space required by the second image file is less than that required by the first image file. The generation module 602 is used to generate a pseudo file based on the first image file and the second image file. The pseudo file has the same format and filename as the first image file, and there is a correspondence between the pseudo file and the second image file. The pseudo file and the second image file are used to be stored in a memory.
[0084] In one possible design, the computer device 600 further includes: an acquisition module 603, configured to acquire the pseudo file in response to a request for acquiring the first image file, and acquire the second image file based on the pseudo file; and an encoding / decoding module 601, further configured to decode the second image file into the first image file.
[0085] In one possible design, the encoding / decoding module 601 is specifically used to losslessly encode the first image file into a second image file.
[0086] In one possible design, the pseudo file and the second image file are two independent files; the pseudo file and the second image file have a corresponding relationship, including: the pseudo file includes the filename and storage path of the second image.
[0087] In one possible design, the pseudo file corresponds to the second image file, including: the pseudo file contains the second image file; the pseudo file includes the storage path of the second image.
[0088] In one possible design, the first image file is obtained by taking a picture with a camera; or, the first image file is obtained by receiving it through an application; or, the first image file is obtained from memory.
[0089] In one possible design, the first image file is in any of the following image formats: JPEG, PNG, or GIF.
[0090] In one possible design, the first image file is retrieved from memory, and the access frequency of the first image is lower than a preset value.
[0091] In one possible design, the computer device 600 further includes a sending module 604 for sending the pseudo file and the second image to a memory for storage.
[0092] In one possible design, the computer device 600 also includes a storage module 605 for storing the pseudo file and the second image.
[0093] Please see Figure 7 , Figure 7 This is a schematic diagram of a computer device provided in an embodiment of this application. The computer device 700 includes: an acquisition module 701 and a decoding module 702. The acquisition module 701 is used to acquire a pseudo file in response to a request for acquiring a first image file. The request information includes the filename and format of the first image. The filename and format of the pseudo file are the same as those of the first image. The acquisition module 701 is also used to acquire a second image file based on the pseudo file. The pseudo file and the second image file have a corresponding relationship. The decoding module 702 is used to decode the second image file into the first image file. The first image file and the second image file have different formats. The storage space required by the second image file is less than that required by the first image file.
[0094] In one possible design, the pseudo file and the second image file are two independent files; the pseudo file and the second image file have a corresponding relationship, including: the pseudo file includes the filename and storage path of the second image.
[0095] In one possible design, the pseudo file corresponds to the second image file, including: the pseudo file contains the second image file; the pseudo file includes the storage path of the second image.
[0096] In one possible design, the first image file is in any of the following image formats: JPEG, PNG, or GIF.
[0097] This application also provides a computer device; please refer to [link / reference]. Figure 8 , Figure 8 This is a schematic diagram of a computer device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiment of this application. The computer device 800 may be deployed with... Figure 6 and Figure 7 The module described in the corresponding embodiment is used to implement Figure 6 The functions of computer device 600 in the corresponding embodiment and Figure 7 The corresponding embodiment describes the function of computer device 700. Specifically, computer device 800 is implemented by one or more servers. Computer device 800 can vary significantly due to different configurations or performance, and may include one or more central processing units (CPUs) 822 and memory 832, and one or more storage media 830 (e.g., one or more mass storage devices) for storing application programs 842 or data 844. The memory 832 and storage media 830 can be temporary or persistent storage. The program stored in storage media 830 may include one or more modules (not shown in the figure), each module may include a series of instruction operations on computer device 800. Furthermore, the CPU 822 may be configured to communicate with storage media 830 and execute the series of instruction operations in storage media 830 on computer device 800.
[0098] The computer device 800 may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input / output interfaces 858, and / or one or more operating systems 841, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0099] In this embodiment, the central processing unit 822 is used to execute... Figure 2 and Figure 4 The image processing method in the corresponding embodiment. For example, the central processing unit 822 can be used to: encode a first image file into a second image file, wherein the format of the first image file is different from that of the second image file, and the storage space required by the second image file is less than that required by the first image file; generate a pseudo file based on the first image file and the second image file, wherein the pseudo file has the same format and filename as the first image file, and the pseudo file has a corresponding relationship with the second image file; and store the pseudo file and the second image file in a memory.
[0100] It should be noted that the central processing unit 822 can also be used to perform operations related to those described in this application. Figure 2 and Figure 4 For details of any step in the corresponding method embodiment, please refer to the description in the method embodiment shown above in this application, which will not be repeated here.
[0101] This application also provides a computer-readable storage medium storing a program for signal processing, which, when run on a computer, causes the computer to perform the steps performed by the computer device as described in the foregoing embodiments.
[0102] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0103] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0104] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0105] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs (DVDs)), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. An image processing method, characterized in that, include: The first image file is encoded into a second image file. The format of the first image file is different from that of the second image file. The storage space required for the second image file is less than that required for the first image file. A pseudo file is generated based on the first image file and the second image file. The pseudo file has the same format and filename as the first image file. The pseudo file has a corresponding relationship with the second image file. The pseudo file and the second image file are used to save in the memory. The pseudo-file includes a pseudo-file identifier; the pseudo-file identifier is used to indicate that the pseudo-file is a dummy file and is not the real first image file. When the pseudo file and the second image file are stored as two separate files, the pseudo file includes the filename and storage path of the second image file; When the pseudo file contains the second image file for storage, the pseudo file includes the second image file and a pseudo file header. The pseudo file header includes the storage path of the second image file to indicate the starting byte position of the second image file in the pseudo file. The pseudo file is located using the filename and format, and the second image file is located using the relevant information of the second image file in the pseudo file.
2. The method according to claim 1, characterized in that, The method further includes: In response to the request to obtain the first image file, the pseudo file is obtained; The second image file is obtained based on the pseudo file; The second image file is decoded into the first image file.
3. The method according to claim 1 or 2, characterized in that, Encoding the first image file into a second image file includes: The first image file is losslessly encoded into the second image file.
4. The method according to claim 1 or 2, characterized in that, The first image file was obtained by taking a picture with a camera; or... The first image file is received by the application; or, The first image file was obtained from the memory.
5. The method according to claim 1 or 2, characterized in that, The first image file can be in any of the following image formats: JPEG, PNG, or GIF format.
6. The method according to claim 1 or 2, characterized in that, The first image file was retrieved from the memory, and the access frequency of the first image file is lower than a preset value.
7. A computer device, characterized in that, include: An encoding module is used to encode a first image file into a second image file. The format of the first image file is different from that of the second image file, and the storage space required for the second image file is less than that required for the first image file. A generation module is used to generate a pseudo file based on the first image file and the second image file. The pseudo file has the same format and filename as the first image file, and there is a corresponding relationship between the pseudo file and the second image file. The pseudo file and the second image file are used to store in a memory. The pseudo file includes a pseudo file identifier, which indicates that the pseudo file is a puppet file and not the real first image file. When the pseudo file and the second image file are stored as two independent files, the pseudo file includes the filename and storage path of the second image file. When the pseudo file contains the second image file, the pseudo file includes the second image file and a pseudo file header. The pseudo file header includes the storage path of the second image file to indicate the starting byte position of the second image file in the pseudo file. The pseudo file is located by the filename and format, and the second image file is located by the relevant information of the second image file in the pseudo file.
8. The device according to claim 7, characterized in that, The device also includes: The acquisition module is used to acquire the pseudo file in response to a request to acquire the first image file; The acquisition module is also used to acquire the second image file based on the pseudo file; The decoding module is used to decode the second image file into the first image file.
9. The device according to claim 7 or 8, characterized in that, The encoding module is specifically used for: The first image file is losslessly encoded into the second image file.
10. A computer device comprising a processor and a memory, the processor being coupled to the memory, characterized in that, The memory is used to store programs; The processor is configured to execute a program in the memory, causing the computer device to perform the method as described in any one of claims 1-6.
11. A computer-readable storage medium comprising a program, which, when executed on a computer, causes the computer to perform the method as described in any one of claims 1-6.
12. A computer program product comprising instructions that, when run on a computer, cause the computer to perform the method as described in any one of claims 1-6.
Citation Information
Patent Citations
File storage method and apparatus based on non-relational database
CN105653692A
Cloud file transmission method, terminal and cloud server
CN106332556A
