Image transcoding compression method and device and image transcoding decompression method and device based on object attributes
Through the image transcoding compression and decompression method based on object attributes, the problem of low encoding efficiency of image file formats in the existing technology is solved, efficient storage and rapid restoration of the original format are achieved, and the user experience and storage efficiency are improved.
Patent Information
- Application Number
- CN202411148345.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-08-21
AI Technical Summary
The encoding efficiency of existing image file formats is low, resulting in large storage space usage and affecting user experience.
Using an image transcoding compression and decompression method based on object attributes, the object storage gateway and the server work together to automatically transcode the image data into a high-efficiency format for storage, and restore the original format when reading, saving storage space without affecting the application. The program runs.
It greatly reduces the storage space occupied, improves the operating efficiency, improves the user experience, and reduces the storage space occupied without the user being aware of it.
Smart Images

Figure CN118660164A
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the field of data processing technology, and in particular to a method and device for image transcoding compression and decompression based on object attributes. Background Art
[0002] In the prior art, data compression is divided into lossy compression and lossless compression. In the field of image processing, lossy compression or lossless compression can be selected according to the requirements for image accuracy.
[0003] The image files currently stored are mostly in traditional image formats such as JPG / PNG. Since the image encoding technology corresponding to these image formats belongs to the encoding technology invented in the 1990s, there is a big gap between their encoding efficiency and the AVIF / HEIF / WebP2 image encoding formats proposed in recent years. When users store image files, not only a large storage space is required, but the storage space occupation will also affect the user's application, thereby affecting the user experience.
[0004] Therefore, how to design an image transcoding compression algorithm with high compression efficiency, small data space occupation and good user experience is a technical problem to be solved. Summary of the invention
[0005] Based on this, it is necessary to provide a method and device for image transcoding, compression and decompression based on object attributes to address the existing problems, so that when a user stores an image file, the image stored by the user can be automatically transcoded into an image format with higher compression efficiency for storage; when the user reads the image file, the transcoded image is converted into the original format and returned to the user. This can greatly save storage space without affecting the operation of the user's application, thereby saving storage costs while the application is unaware.
[0006] In a first aspect, an embodiment of the present application provides an image transcoding and compression method based on object attributes, comprising the following steps: The object storage gateway receives an image data write request sent by a client, wherein the image data write request includes source image data; The object storage gateway determines whether the source image data is a transcoded compression object according to the image format of the source image data; In response to the source image data being a transcoded compressed object, the object storage gateway stores the source image data; The object storage gateway initiates an asynchronous task to push the transcoded compression message of the object to the message queue of the server; When the server reads the transcoding compression message in the message queue, the server uses the transcoding compression algorithm and the transcoding compression parameters contained in the transcoding compression message; The server transcodes and compresses the source image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain compressed image data; The object storage gateway overwrites the source image data with the compressed image data and stores the compressed image data, and saves the transcoding compression algorithm and transcoding compression parameters to the object metadata information of the transcoding compression object.
[0007] Preferably, the server transcodes and compresses the source image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain compressed image data, including: Reading the source image data, and acquiring an image encoding format based on header information of the source image data; Decoding the portion of the source image data excluding header information based on the image coding format to obtain BMP raw format image data of the source image data; Encoding the BMP raw format image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain encoded image data; The header information of the source image data and the encoded image data are combined to obtain the compressed image data.
[0008] Preferably, after the transcoding compression algorithm and the transcoding compression parameters are saved in the object metadata information of the transcoding compression object, the method further includes: The server deletes the transcoded compressed message in the message queue.
[0009] Preferably, the object metadata information includes image parameters of the source image data and image parameters of the compressed image data.
[0010] Preferably, the transcoding compression parameters are determined by image parameters of the source image data.
[0011] In a second aspect, an embodiment of the present application provides an image transcoding and decompression method based on object attributes, comprising the following steps: The object storage gateway receives an image data reading request sent by a client, wherein the image data reading request includes an image data identifier; The object storage gateway obtains object metadata information corresponding to the image data identifier; The object storage gateway determines whether the object is a transcoded compressed object according to the object metadata information; In response to the object being a transcoded compressed object, obtaining compressed image data corresponding to the image data identifier; The backend server matches the transcoding decompression algorithm and transcoding compression parameters of the compressed image data according to the image parameters of the compressed image data; The backend server transcodes and decompresses the compressed image data according to the transcoding and decompression algorithm and the transcoding and compression parameters to obtain source image data corresponding to the image data identifier; The backend server sends the source image data to the client.
[0012] Preferably, the backend server transcodes and decompresses the compressed image data according to the transcoding and decompression algorithm and the transcoding and compression parameters to obtain the source image data corresponding to the image data identifier, including: Decoding the compressed image data excluding the header information according to the transcoding decompression algorithm and the transcoding compression parameters to obtain the raw format image data of the compressed image data; Encoding the naked format image data according to the source image format indicated by the image data identifier to obtain source data in the source image format; The source data and the header information of the compressed image data are combined to obtain the source image data.
[0013] Preferably, the object metadata information includes image parameters of the compressed image data and image parameters of the source image data.
[0014] Preferably, the transcoding compression parameters are determined by image parameters of the source image data.
[0015] In a third aspect, an embodiment of the present application provides an image transcoding and compression device based on object attributes, comprising: A receiving module, used for receiving an image data writing request sent by a client, wherein the image data writing request includes source image data; A judging module, used for judging whether the source image data is a transcoding compression object according to the image format of the source image data; A storage module, configured to store the source image data in response to the source image data being a transcoding compression object; The message push module is used to initiate asynchronous tasks and push the transcoded compressed messages of the objects to the message queue of the server; A message processing module, configured to, when reading a transcoding and compression message from a message queue, process the transcoding and compression algorithm and transcoding and compression parameters contained in the transcoding and compression message; A transcoding and compression module, used for performing transcoding and compression on the source image data according to the transcoding and compression algorithm and transcoding and compression parameters to obtain compressed image data; The sending module is used to cover the source image data with the compressed image data and store them, and save the transcoding compression algorithm and transcoding compression parameters to the object metadata information of the transcoding compression object.
[0016] In a fourth aspect, an embodiment of the present application provides an image transcoding and decompression device based on object attributes, comprising: A receiving module, used for receiving an image data reading request sent by a client, wherein the image data reading request includes an image data identifier; An acquisition module, used to acquire object metadata information corresponding to the image data identifier; A judging module, used for judging whether the object is a transcoded compressed object according to the object metadata information; A reading module, configured to obtain compressed image data corresponding to the image data identifier in response to the object being a transcoded compressed object; A processing module, used for matching a transcoding decompression algorithm and a transcoding compression parameter of the compressed image data according to the image parameters of the compressed image data; A transcoding and decompression module, used for transcoding and decompressing the compressed image data according to the transcoding and decompression algorithm and transcoding compression parameters, to obtain source image data corresponding to the image data identifier; The sending module is used to send the source image data to the client.
[0017] Compared with the prior art, the present invention has the following beneficial effects: (1) combining object attributes to realize transcoding compression of image data files, reducing the storage space occupied and greatly improving the operation efficiency; (2) combining object attributes to realize offline transcoding compression and online decoding of image data files, reducing the occupied storage space without the user's perception, and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] By referring to the following drawings, the exemplary embodiments of the present invention can be more completely understood. The drawings are used to provide a further understanding of the embodiments of the present application, and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present invention and do not constitute a limitation of the present invention. In the drawings, the same reference numerals generally represent the same parts or steps.
[0019] Figure 1 A flowchart of a data transcoding and compression method based on object attributes provided by an exemplary embodiment of the present application is shown; Figure 2 A flowchart of a data transcoding and decompression method based on object attributes provided by an exemplary embodiment of the present application is shown; Figure 3 A schematic diagram of the structure of a data transcoding and compression device based on object attributes provided by an exemplary embodiment of the present application is shown; Figure 4 A schematic diagram of the structure of a data transcoding and decompression device based on object attributes provided by an exemplary embodiment of the present application is shown; Figure 5 A schematic diagram of an electronic device provided by an exemplary embodiment of the present application is shown; Figure 6 A schematic diagram of a computer-readable medium provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0020] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0021] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0022] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0023] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0024] Example 1 An embodiment of the present application provides a data transcoding and compression method based on object attributes, which is described below in conjunction with the accompanying drawings.
[0025] Reference Figure 1 , which shows a data transcoding and compression method based on object attributes provided by some embodiments of the present application, comprising the following steps: S101: The object storage gateway receives an image data write request sent by a client, where the image data write request includes source image data; Specifically, the write request includes an identifier of the data to be written and source image data, including the format of the data, such as an image or other data, and the image includes BMP format, JPG format, TIF format and / or PNG format.
[0026] S102: The object storage gateway determines whether the source image data is a transcoding compression object according to the image format of the source image data; S103: In response to the source image data being a transcoded compression object, the object storage gateway stores the source image data; Specifically, after receiving the user's request to upload a file, the object storage gateway first writes the file data to the backend storage, and at the same time determines whether the file is an image file based on the file suffix format (for example, the file suffix format is bmp, jpg, png, tif). If the file is an image file and is within the range of image formats that support transcoding and compression, the object storage gateway records an operation log while updating the object metadata, marking the object as eligible for transcoding and compression.
[0027] Specifically, the user creates a bucket in the object storage cluster and configures the compression policy of the bucket through the management page. When the object attribute is a transcoding compression object, the transcoding compression algorithm can be a public image encoding algorithm such as AVIF / HEIF / WebP / WebP2, or a self-developed private image encoding and decoding algorithm, as long as the storage space of the compressed image is smaller, that is, the storage space occupied by the target compressed image data is smaller than the storage space occupied by the original image data.
[0028] S104: The object storage gateway initiates an asynchronous task to push the object transcoding and compression message to the message queue of the server; After the object metadata is successfully updated, the object storage gateway replies to the user with a response that the write request has been successfully processed. The object storage synchronization gateway periodically scans the operation log. If the operation log shows that the object needs to be transcoded and compressed, it sends a message to the data processing module through the message notification module to perform image transcoding and compression processing in combination with the transcoding strategy / algorithm configured in the object bucket attributes.
[0029] S105: When the server reads the transcoding compression message in the message queue, the server uses the transcoding compression algorithm and transcoding compression parameters contained in the transcoding compression message; Specifically, after receiving the message request through the message module, the data processing platform reads the corresponding image data, matches the transcoding algorithm in combination with the target format specified in the message, and then transcodes and compresses the file.
[0030] S106: The server performs transcoding compression on the source image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain compressed image data; Specifically, step S106 includes: Read source image data, and obtain the image encoding format based on header information of the source image data; Decoding the source image data excluding the header information based on the image coding format to obtain the BMP raw format image data of the source image data; Encode the BMP raw format image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain encoded image data; The header information of the source image data and the encoded image data are combined to obtain compressed image data.
[0031] S107: The object storage gateway overwrites the source image data with the compressed image data and stores the compressed image data, and saves the transcoding compression algorithm and transcoding compression parameters to the object metadata information of the transcoding compression object.
[0032] Specifically, the object metadata information includes image parameters of the original image data and image parameters of the target compressed image data, and the image parameters include data or information indicating the image, such as image size and image format.
[0033] Specifically, the new image file, i.e., the compressed image data, is overwritten and written to the backend storage, and the object is marked as a transcoded compression object in the object attributes. In this embodiment, the source image information and the encoding algorithm information can be stored in the object attributes; after the transcoding and compression processing is successful, the data processing platform deletes the message notification from the message queue. Specifically, after the current write request is completed, the obtained transcoded compressed data and its corresponding object metadata and the algorithm matching the transcoding and compression are all stored. When the same write request appears again in the future, the stored related data can be directly called without the need to compress the data again, which can greatly shorten the processing time and reduce the space occupied by the image data, and ultimately ensure the processing efficiency of the image data.
[0034] Example 2 Reference Figure 2 The present application embodiment provides a method for transcoding and decompressing digital images based on object attributes, comprising the following steps: S201: The object storage gateway receives an image data reading request sent by a client, where the image data reading request includes an image data identifier; S202: The object storage gateway obtains object metadata information corresponding to the image data identifier; S203: The object storage gateway determines whether the object is a transcoded compressed object according to the object metadata information; Specifically, after receiving a read request from a client, the object gateway first obtains metadata information of the object corresponding to the read request. If the object is determined to be an uncompressed object through attribute information, the corresponding data is directly read based on the metadata information and a response is sent to the client.
[0035] S204: In response to the object being a transcoded compressed object, obtaining compressed image data corresponding to the image data identifier; If the object is determined to be a compressed object through the attribute information, a redirect response message is sent back, and the HTTP proxy (Nginx) forwards the request to the data processing platform again.
[0036] S205: The backend server matches the transcoding decompression algorithm and the transcoding compression parameters according to the image parameters of the compressed image data; S206: The backend server transcodes and decompresses the compressed image data according to the transcoding and decompression algorithm and the transcoding and compression parameters to obtain source image data corresponding to the image data identifier; Specifically, the data processing platform obtains the object data from the storage background, and decodes it in combination with the encoding and decoding information of the object, restores it to the original encoding format, and replies with a response corresponding to the read request. Therefore, step S206 specifically includes: Decoding the compressed image data excluding the header information according to the transcoding decompression algorithm and the transcoding compression parameters to obtain the raw format image data of the compressed image data; Encoding the raw format image data according to the source image format indicated by the image data identifier to obtain source data in the source image format; The source data and the header information of the compressed image data are combined to obtain the source image data.
[0037] S207: The backend server sends the source image data to the client.
[0038] Specifically, the object metadata information includes image parameters of the compressed image data and image parameters of the target image data. The transcoding compression parameters are determined by the image parameters of the target image data.
[0039] Compared with the prior art, the present invention has the following beneficial effects: (1) combining object attributes to realize transcoding compression of image data files, reducing the storage space occupied and greatly improving the operation efficiency; (2) combining object attributes to realize offline transcoding compression and online decoding of image data files, reducing the occupied storage space without the user's perception, and improving the user experience.
[0040] Example 3 In the above-mentioned embodiment 1, a method is provided. Corresponding to embodiment 1, the present application also provides a device. The device provided in the embodiment of the present application can implement the above-mentioned method, and the device can be implemented by software, hardware, or a combination of software and hardware. For example, the device can include integrated or separate functional modules or units to perform the corresponding steps in the above-mentioned methods.
[0041] In some implementations of the embodiments of the present application, the device 30 provided in the embodiments of the present application is based on the same inventive concept as the method provided in the aforementioned embodiments of the present application and has the same beneficial effects.
[0042] like Figure 3 , the device 30 may include: A receiving module 301 is used to receive an image data writing request sent by a client, where the image data writing request includes source image data; A determination module 302 is used to determine whether the source image data is a transcoding compression object according to the image format of the source image data; An execution module 303 is used to store the source image data in response to the source image data being a transcoding compression object; The message push module 304 is used to initiate an asynchronous task and push the transcoded compressed message of the object to the message queue of the server; The message processing module 305 is used for, when reading the transcoding and compression message from the message queue, processing the message according to the transcoding and compression algorithm and transcoding and compression parameters contained in the transcoding and compression message; The transcoding and compression module 306 is used to perform transcoding and compression on the source image data according to the transcoding and compression algorithm and the transcoding and compression parameters to obtain compressed image data; The sending module 307 is used to overwrite the source image data with the compressed image data and store them, and save the transcoding compression algorithm and transcoding compression parameters to the object metadata information of the transcoding compression object.
[0043] Example 4 In the above embodiment 2, a method is provided. Corresponding to embodiment 2, the present application also provides a device. The device provided in the embodiment of the present application can implement the above method, and the device can be implemented by software, hardware, or a combination of software and hardware. For example, the device can include integrated or separate functional modules or units to perform the corresponding steps in the above methods.
[0044] In some implementations of the embodiments of the present application, the device 40 provided in the embodiments of the present application is based on the same inventive concept as the method provided in the aforementioned embodiments of the present application and has the same beneficial effects.
[0045] like Figure 4 , the device 40 may include: A receiving module 401 is used to receive an image data reading request sent by a client, wherein the image data reading request includes an image data identifier; An acquisition module 402 is used to acquire object metadata information corresponding to the image data identifier; A determination module 403 is used to determine whether the object is a transcoded compressed object according to the object metadata information; A reading module 404, configured to obtain compressed image data corresponding to the image data identifier in response to the object being a transcoded compressed object; A processing module 405 is used to match a transcoding decompression algorithm and a transcoding compression parameter according to image parameters of the compressed image data; The transcoding and decompression module 406 is used to transcode and decompress the compressed image data according to the transcoding and decompression algorithm and the transcoding and compression parameters to obtain the source image data corresponding to the image data identifier; The sending module 407 is used to send the source image data to the client.
[0046] Example 5 An embodiment of the present application also provides an electronic device corresponding to the method provided in the above embodiment, and the electronic device may be an electronic device for a server, such as a server, including an independent server and a distributed server cluster, etc., to execute the above method.
[0047] Please refer to Figure 5 , which shows a schematic diagram of a smart wearable device provided by some embodiments of the present application. Figure 5 As shown, the electronic device 50 includes: a processor 500, a memory 501, a bus 502 and a communication interface 503, and the processor 500, the communication interface 503 and the memory 501 are connected via the bus 502; the memory 501 stores a computer program that can be run on the processor 500, and the processor 500 executes the aforementioned method of the present application when running the computer program.
[0048] The memory 501 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 503 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0049] The bus 502 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 501 is used to store programs, and the processor 500 executes the programs after receiving execution instructions. The method disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 500, or implemented by the processor 500.
[0050] The processor 500 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 500. The above processor 500 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 501, and the processor 500 reads the information in the memory 501 and completes the steps of the above method in combination with its hardware.
[0051] The electronic device provided in the embodiment of the present application and the method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, operated or implemented by them.
[0052] Example 6 The present application also provides a computer-readable medium corresponding to the method provided in the above embodiment. Figure 6 The computer-readable storage medium shown is a CD 60 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the aforementioned method is executed.
[0053] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0054] It should be noted that the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0055] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0056] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. 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 is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0057] 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 network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0058] 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.
[0059] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0060] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application.
Claims
1. An image transcoding and compression method based on object attributes, characterized in that: The steps include: The object storage gateway receives an image data write request sent by a client, wherein the image data write request includes source image data; The object storage gateway determines whether the source image data is a transcoded compression object according to the image format of the source image data; In response to the source image data being a transcoded compressed object, the object storage gateway stores the source image data; The object storage gateway initiates an asynchronous task to push the transcoded compression message of the object to the message queue of the server; When the server reads the transcoding compression message in the message queue, the server uses the transcoding compression algorithm and the transcoding compression parameters contained in the transcoding compression message; The server transcodes and compresses the source image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain compressed image data; The object storage gateway overwrites the source image data with the compressed image data and stores the compressed image data, and saves the transcoding compression algorithm and transcoding compression parameters to the object metadata information of the transcoding compression object.
2. The image transcoding and compression method based on object attributes according to claim 1, characterized in that: The server transcodes and compresses the source image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain compressed image data, including: Reading the source image data, and acquiring an image encoding format based on header information of the source image data; Decoding the portion of the source image data excluding the header information based on the image coding format to obtain BMP raw format image data of the source image data; Encoding the BMP raw format image data according to the transcoding compression algorithm and the transcoding compression parameters to obtain encoded image data; The header information of the source image data and the encoded image data are combined to obtain the compressed image data.
3. The image transcoding and compression method based on object attributes according to claim 1, characterized in that: After the transcoding compression algorithm and the transcoding compression parameters are saved in the object metadata information of the transcoding compression object, the method further includes: The server deletes the transcoded compressed message in the message queue.
4. The method for image transcoding and compression based on object attributes according to claim 1, characterized in that: The object metadata information includes image parameters of the source image data and image parameters of the compressed image data.
5. The image transcoding and compression method based on object attributes according to claim 1, characterized in that: The transcoding compression parameters are determined by image parameters of the source image data.
6. An image transcoding and decompression method based on object attributes, characterized in that: The steps include: The object storage gateway receives an image data reading request sent by a client, wherein the image data reading request includes an image data identifier; The object storage gateway obtains object metadata information corresponding to the image data identifier; The object storage gateway determines whether the object is a transcoded compressed object according to the object metadata information; In response to the object being a transcoded compressed object, obtaining compressed image data corresponding to the image data identifier; The backend server matches the transcoding decompression algorithm and transcoding compression parameters of the compressed image data according to the image parameters of the compressed image data; The backend server transcodes and decompresses the compressed image data according to the transcoding and decompression algorithm and the transcoding and compression parameters to obtain source image data corresponding to the image data identifier; The backend server sends the source image data to the client.
7. The method for image transcoding and decompression based on object attributes according to claim 6, characterized in that: The backend server transcodes and decompresses the compressed image data according to the transcoding and decompression algorithm and the transcoding and compression parameters to obtain source image data corresponding to the image data identifier, including: Decoding the compressed image data excluding the header information according to the transcoding decompression algorithm and the transcoding compression parameters to obtain the raw format image data of the compressed image data; Encoding the naked format image data according to the source image format indicated by the image data identifier to obtain source data in the source image format; The source data and the header information of the compressed image data are combined to obtain the source image data.
8. The method for image transcoding and decompression based on object attributes according to claim 6, characterized in that: The object metadata information includes image parameters of the compressed image data and image parameters of the source image data.
9. The method for image transcoding and decompression based on object attributes according to claim 6, characterized in that: The transcoding compression parameters are determined by image parameters of the source image data.
10. An image transcoding and compression device based on object attributes, characterized in that: include: A receiving module, used for receiving an image data writing request sent by a client, wherein the image data writing request includes source image data; A judging module, used for judging whether the source image data is a transcoding compression object according to the image format of the source image data; an execution module, configured to store the source image data in response to the source image data being a transcoding compression object; The message push module is used to initiate asynchronous tasks and push the transcoded compressed messages of the objects to the message queue of the server; A message processing module, configured to, when a transcoding and compression message is read from a message queue, process the message according to the transcoding and compression algorithm and transcoding and compression parameters contained in the transcoding and compression message; A transcoding and compression module, used for performing transcoding and compression on the source image data according to the transcoding and compression algorithm and transcoding and compression parameters to obtain compressed image data; The sending module is used to cover the source image data with the compressed image data and store them, and save the transcoding compression algorithm and transcoding compression parameters to the object metadata information of the transcoding compression object.
11. An image transcoding and decompression device based on object attributes, characterized in that: include: A receiving module, used for receiving an image data reading request sent by a client, wherein the image data reading request includes an image data identifier; An acquisition module, used to acquire object metadata information corresponding to the image data identifier; A judging module, used for judging whether the object is a transcoded compressed object according to the object metadata information; A reading module, configured to obtain compressed image data corresponding to the image data identifier in response to the object being a transcoded compressed object; A processing module, used for matching a transcoding decompression algorithm and a transcoding compression parameter of the compressed image data according to the image parameters of the compressed image data; A transcoding and decompression module, used for transcoding and decompressing the compressed image data according to the transcoding and decompression algorithm and transcoding compression parameters, to obtain source image data corresponding to the image data identifier; The sending module is used to send the source image data to the client.
Citation Information
Patent Citations
Mobile video new media production, uploading and publishing system
CN103533382A
Audio-video stream transcoding method and equipment
CN108712654A
Image transcoding method and device
CN108805943A
Intelligent transcoding method and device, electronic equipment and storage medium
CN112422978A
Image loading method, device and equipment
CN118338044A
