Method for mutual conversion between iBootim image and PNG image and related device

By using a method to convert between iBootim and PNG images, the technical obstacles to displaying the Apple device startup screen logo have been overcome, enabling convenient conversion from PNG to iBootim images and meeting the needs of custom logos.

CN115795066BActive Publication Date: 2026-07-14AFIRSTSOFT CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AFIRSTSOFT CO LTD
Filing Date
2022-12-28
Publication Date
2026-07-14

Smart Images

  • Figure CN115795066B_ABST
    Figure CN115795066B_ABST
Patent Text Reader

Abstract

The application relates to the field of format conversion, and discloses a mutual conversion method of iBootim images and PNG images and a related device thereof.The method comprises the following steps: receiving picture data to be converted; judging whether the picture data is in PNG format; if the picture data is in PNG format, extracting feature data of the picture data, modifying the feature data to obtain modified feature data, updating the modified feature data to a PNG INFO structure of the picture data to obtain updated PNG INFO structure data; writing the updated PNG INFO structure data into an iBootim structure to obtain conversion data; if the picture data is not in PNG format, judging whether the picture data is in iBootim format; if the picture data is not in iBootim format, sending picture error information to a preset management port; if the picture data is in iBootim format, decompressing pixel data of the picture data, updating an iBootim structure of the picture data to obtain updated iBootim structure data; writing the updated iBootim structure data into a PNG INFO structure to obtain conversion data; and writing the conversion data into a preset folder to obtain saved data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data conversion, and more particularly to a method and apparatus for mutual conversion between iBootim images and PNG images. Background Technology

[0002] The Apple logo is located in the IPSW (In-System Width). Apple flashes its logo onto a NOR partition and displays it at boot time. The Apple logo is an iBootim image with an alpha channel. To display the brand logo on the device's boot screen during the Apple device repair process, an iBootim image with an alpha channel needs to be generated to update the display. iBootim is an image type used by Apple, primarily for generating an image that displays the Apple logo on the device's screen during boot. This image is located in the firmware compressed data.

[0003] Due to the closed nature of the macOS system and the lack of technical documentation from Apple regarding the iBootim image format, there is currently no tool or solution available to convert common images to the iBootim image format. Therefore, a new technology is needed to address the technical issue of the inability to convert common images to the iBootim image format. Summary of the Invention

[0004] The main objective of this invention is to solve the technical problem that common images cannot be converted into the iBootim image format.

[0005] The first aspect of this invention provides a method for mutual conversion between iBootim images and PNG images, the method comprising:

[0006] Receive image data to be converted;

[0007] Determine whether the image data is in PNG format;

[0008] If it is in PNG format, the feature data of the image data is extracted, the feature data is modified to obtain corrected feature data, and the corrected feature data is updated to the PNG INFO structure of the image data to obtain updated PNG INFO structure data.

[0009] The iBootim structure is constructed by initializing the iBootim properties, and the updated PNG INFO structure data is written into the iBootim structure to obtain the converted data;

[0010] If it is not in PNG format, then determine whether the image data is in iBootim format;

[0011] If the image is not in iBootim format, an image error message will be sent to the preset management port.

[0012] If it is in iBootim format, then initialize the iBootim structure of the image data, decompress the pixel data of the image data, update the iBootim structure of the image data, and obtain the updated iBootim structure data;

[0013] The PNG INFO property is initialized to construct a PNG INFO structure, and the updated iBootim structure data is written into the PNG INFO structure to obtain the converted data;

[0014] The converted data is written to a preset folder to obtain the saved data.

[0015] Optionally, in a first implementation of the first aspect of the present invention, determining whether the image data is in iBootim format includes:

[0016] Construct the iBootimHeader structure;

[0017] The image data is opened in read-only mode, the binary header data of the image data is extracted, and the binary header data is used to update the iBootimHeader structure to obtain iBootim analysis data.

[0018] Determine whether the size of the iBootim analysis data is consistent with that of the iBootimHeader structure;

[0019] If the sizes are inconsistent, it is confirmed that the image data is not in iBootim format;

[0020] If the sizes are the same, then read the signature data of the iBootim analysis data and determine whether the signature data is consistent with the iBootim field;

[0021] If the characters are inconsistent, it is confirmed that the image data is not in iBootim format;

[0022] If the fields match, then read the compression type field of the iBootim analysis data and determine whether the compression type field has a valid value;

[0023] If no valid value is found, it is confirmed that the image data is not in iBootim format;

[0024] If a valid value exists, the color space data of the iBootim analysis data is read, and it is determined whether there are invalid values ​​in the color space data.

[0025] If an invalid value exists, it is confirmed that the image data is not in iBootim format;

[0026] If no invalid values ​​are found, the image data is confirmed to be in iBootim format.

[0027] Optionally, in a second implementation of the first aspect of the present invention, the step of extracting feature data from the image data and modifying the feature data to obtain corrected feature data includes:

[0028] Extract the feature data of the image data, detect the byte depth and color type of the feature data, and obtain the detection result;

[0029] Based on the detection results, the feature data is transformed to obtain corrected feature data.

[0030] Optionally, in a third implementation of the first aspect of the present invention, the initialization of the iBootim attribute to construct the iBootim structure, and the writing of the updated PNG INFO structure data into the iBootim structure to obtain the converted data, includes:

[0031] Based on the aforementioned feature data, the compressed size, color type, and pixel size of the iBootim attributes are defined to obtain the pixel allocation space of the iBootim structure;

[0032] Write the updated PNG INFO structure data into the pixel allocation space of the iBootim structure, and release the memory corresponding to the updated PNG INFO structure data to obtain the initial iBootim structure data;

[0033] Based on the preliminary iBootim structure data, a pre-defined iBootimHeader structure is declared, resulting in the preliminary iBootimHeader structure;

[0034] Based on the uncompressed data size of the initial iBootim structure data, the initial iBootimHeader structure is written into the initial iBootim structure data to obtain the converted data.

[0035] Optionally, in the fourth implementation of the first aspect of the present invention, the steps of initializing the iBootim structure of the image data, decompressing the pixel data of the image data, updating the iBootim structure of the image data, and obtaining updated iBootim structure data include:

[0036] Calculate the uncompressed size of the image data, and allocate a decompression address based on the uncompressed size;

[0037] According to the preset LZSS decompression algorithm, the pixel data of the image data is decompressed to obtain decompressed data;

[0038] The decompressed data is stored in the decompression address, and the iBootim structure of the image data is updated to obtain the updated iBootim structure data.

[0039] Optionally, in a fifth implementation of the first aspect of the present invention, the initialization of the PNG INFO attribute constructs a PNG INFO structure, and the updated iBootim structure data is written into the PNG INFO structure to obtain the converted data, including:

[0040] Based on the updated iBootim structure data, the png_set_IHDR() function of the pre-built libpng library is used to set the PNG_IHDR block data to obtain the PNG_INFO structure data;

[0041] Based on the png_set_rows() function, the updated iBootim structure data is written into the PNG INFO structure to obtain the converted data.

[0042] Optionally, in a sixth implementation of the first aspect of the present invention, writing the converted data into a preset folder to obtain the saved data includes:

[0043] When the image data is in PNG format, the fwrite() function is used to write the converted data to a preset folder to obtain the saved data;

[0044] When the image data is in iBootim format, the png_write_png() function is used to write the converted data to a preset folder to obtain the saved data.

[0045] A second aspect of the present invention provides an apparatus for converting between iBootim images and PNG images, the apparatus comprising:

[0046] The receiving module is used to receive the image data to be converted;

[0047] The first judgment module is used to determine whether the image data is in PNG format;

[0048] The first update module is used to extract feature data of the image data if it is in PNG format, modify the feature data to obtain corrected feature data, and update the corrected feature data into the PNG INFO structure of the image data to obtain updated PNG INFO structure data.

[0049] The first writing module is used to initialize the iBootim attribute to construct the iBootim structure, and write the updated PNGINFO structure data into the iBootim structure to obtain the converted data;

[0050] The second judgment module is used to determine whether the image data is in iBootim format if it is not in PNG format;

[0051] The information sending module is used to send image error information to the preset management port if the image is not in iBootim format.

[0052] The second update module is used to initialize the iBootim structure of the image data if it is in iBootim format, decompress the pixel data of the image data, update the iBootim structure of the image data, and obtain updated iBootim structure data.

[0053] The second writing module is used to initialize the PNG INFO attribute to construct a PNG INFO structure, and write the updated iBootim structure data into the PNG INFO structure to obtain the converted data;

[0054] The saving module is used to write the converted data into a preset folder to obtain the saved data.

[0055] A third aspect of the present invention provides an iBootim image and PNG image conversion device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a circuit; the at least one processor invokes the instructions in the memory to cause the iBootim image and PNG image conversion device to perform the aforementioned iBootim image and PNG image conversion method.

[0056] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described method for converting between iBootim images and PNG images.

[0057] In this embodiment of the invention, third-party products or tools can quickly and easily convert PNG images to iBootim images, or convert iBootim images to PNG images. It also enables third-party products or tools to quickly and easily display their brand logo images on Apple device interfaces, solving the technical problem that common images cannot be converted to the iBootim image format. Attached Figure Description

[0058] Figure 1 This is a schematic diagram of an embodiment of the method for mutual conversion between iBootim images and PNG images in this invention;

[0059] Figure 2 This is a schematic diagram of one embodiment of the iBootim image and PNG image conversion device of the present invention;

[0060] Figure 3 This is a schematic diagram of one embodiment of the iBootim image and PNG image conversion device in this invention. Detailed Implementation

[0061] This invention provides a method and related apparatus for converting between iBootim images and PNG images.

[0062] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0063] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 One embodiment of the method for mutual conversion between iBootim images and PNG images in this invention includes:

[0064] 101. Receive the image data to be converted;

[0065] 102. Determine whether the image data is in PNG format;

[0066] 103. If it is in PNG format, extract the feature data of the image data, modify the feature data to obtain corrected feature data, and update the corrected feature data into the PNG INFO structure of the image data to obtain updated PNG INFO structure data.

[0067] 104. Initialize the iBootim property to construct the iBootim structure, and write the updated PNG INFO structure data into the iBootim structure to obtain the converted data;

[0068] 105. If it is not in PNG format, then determine whether the image data is in iBootim format;

[0069] 106. If the image is not in iBootim format, send an image error message to the preset management port;

[0070] 107. If it is in iBootim format, initialize the iBootim structure of the image data, decompress the pixel data of the image data, update the iBootim structure of the image data, and obtain the updated iBootim structure data;

[0071] 108. Initialize the PNG INFO property to construct the PNG INFO structure, and write the updated iBootim structure data into the PNG INFO structure to obtain the converted data;

[0072] 109. Write the converted data into a preset folder to obtain the saved data.

[0073] Steps 101-108 can be explained using the following steps:

[0074] S10: First, import the paths of the image files to be converted and the converted image files. Then, check if the size of the file to be converted is not zero to preliminarily determine if the image file contains data.

[0075] S20: Determine if the file is a PNG image. If it is not a PNG image, proceed to S30. If it is a PNG image, proceed to S50 via S40.

[0076] S30: Determine if the file is an iBootim image. If it is not an iBootim image, the process ends and the user is informed that the image passed in is incorrect. If it is an iBootim image, execute steps S40, S50, S60, S70, and S80, and finally proceed to step S120.

[0077] S40: Open the image and extract its data.

[0078] S50: Extract the width, height, color type, and byte depth of the PNG image from the data extracted from S40.

[0079] S60: Modify the data extracted from S50 and update the modified data into the PNG_INFO structure. The PNG_INFO structure belongs to the open-source library libpng, so we will not go into details here.

[0080] S70: Initialize iBootim's properties and construct iBootim's structure. Next, we need to construct an iBootim structure to construct the iBootim image data structure. I declared an iBootim structure to store parameters such as the width, height, X-axis offset, Y-axis offset, compressed size, color space, and pixels of the iBootim image.

[0081] S80: Write the data from the modified PNG_INFO structure in S60 into the iBootim structure, and then proceed with the S120 process.

[0082] S90: Initialize the iBootim structure, parse the iBootim image data, decompress the pixel data, and update the iBootim structure.

[0083] S100: Initialize the attributes of PNG_INFO and construct the structure of PNG_INFO.

[0084] S110: Based on the iBootim structure data initialized by S90, copy the data to the PNG_INFO structure.

[0085] S120: Write the modified data to a file and save it, determining the file extension according to the process.

[0086] Furthermore, the following steps can be performed at 105:

[0087] 1051. Construct the iBootimHeader structure;

[0088] 1052. Open the image data in read-only mode, extract the binary header data of the image data, update the iBootimHeader structure with the binary header data, and obtain iBootim analysis data;

[0089] 1053. Determine whether the size of the iBootim analysis data is consistent with that of the iBootimHeader structure;

[0090] 1054. If the sizes are inconsistent, then the image data is confirmed to be in iBootim format;

[0091] 1055. If the sizes are the same, read the signature data of the iBootim analysis data and determine whether the signature data is consistent with the iBootim field;

[0092] 1056. If the characters are inconsistent, it is confirmed that the image data is not in iBootim format;

[0093] 1057. If the fields are consistent, read the compression type field of the iBootim analysis data and determine whether the compression type field has a valid value;

[0094] 1058. If no valid value exists, then the image data is confirmed to be in iBootim format;

[0095] 1059. If a valid value exists, read the color space data of the iBootim analysis data and determine whether there are invalid values ​​in the color space data;

[0096] 10510. If an invalid value exists, it is confirmed that the image data is not in iBootim format;

[0097] 10511. If no invalid value exists, then the image data is confirmed to be in iBootim format.

[0098] In steps 1051-10511, S301: First, construct a structure to store the image header data. I declare an iBootimHeader structure to store the iBootim image's signature, verification field, compression type, color space, width, height, X-axis offset, Y-axis offset, compression size, and other reserved information.

[0099] S302: Open the image in read-only mode, extract the binary data at the beginning of the image into the structure created by S301, and determine whether the size of the extracted data is consistent with the size of the iBootimHeader structure constructed by S301. If the sizes are inconsistent, close the file, inform the user that the image data extraction failed, and the process ends.

[0100] S303: First, check the signature stored in the iBootimHeader structure constructed in S301. Compare the signature in the iBootimHeader structure with the "iBootIm" field. If they do not match, determine that the file is not an iBootim image and the process ends.

[0101] S304: Check if the compression type field in the iBootimHeader structure constructed in S301 has a valid value. If the compression type field value is invalid, the iBootim image data is determined to be abnormal, and the process ends.

[0102] S305: Check whether the color space in the iBootimHeader structure constructed in S301 has a known value. If it is an invalid color space field value, the iBootim image data is determined to be abnormal, and the process ends.

[0103] S306: If all three tests (S303, S304, and S305) pass, then the image file is determined to be normal iBootim image data.

[0104] Furthermore, in step 103, "extracting feature data from the image data and modifying the feature data to obtain corrected feature data" can be performed by the following steps:

[0105] 1031. Read the feature data of the image data, detect the byte depth and color type of the feature data, and obtain the detection result;

[0106] 1032. Based on the detection results, the feature data is converted to obtain corrected feature data.

[0107] In steps 1031-1032, S601: Detect the byte depth extracted in S50. If it is a 16-byte bit depth, it needs to be converted to an 8-byte bit depth.

[0108] S602: Detect the color type extracted in S50 and determine whether it contains an alpha channel. If it does not contain an alpha channel, add alpha channel data.

[0109] S603: Detects the color type in S50 and determines whether its format is RGB or BGR. If it is RGB, it needs to be converted to BGR format.

[0110] S604: After completing the steps in S601, S602, and S603, set the attributes and update the structure of PNG_INFO.

[0111] Furthermore, in step 104, the following steps are performed:

[0112] 1041. Based on the aforementioned feature data, define the compressed size, color type, and pixel size of the iBootim attributes to obtain the pixel allocation space of the iBootim structure;

[0113] 1042. Write the updated PNG INFO structure data into the pixel allocation space of the iBootim structure, and release the memory corresponding to the updated PNG INFO structure data to obtain the initial iBootim structure data;

[0114] 1043. Based on the preliminary iBootim structure data, declare a pre-defined iBootimHeader structure to obtain the preliminary iBootimHeader structure;

[0115] 1044. Based on the uncompressed data size of the preliminary iBootim structure data, write the preliminary iBootimHeader structure into the preliminary iBootim structure data to obtain the converted data.

[0116] In steps 1041-1044, S801: Initialize the width and height of the iBootim structure declared in S70 using the width and height extracted in S50. Declare the compressed size of the iBootim structure declared in S70 as 0x6C7A7373. Based on the color type extracted in S50, if the color type of the PNG image is RGB, then declare the color type of the iBootim structure declared in S70 as 0x61726762 and the pixel size as 4; otherwise, declare it as 0x67726579 and the pixel size as 2.

[0117] S802: Based on the width, height, and pixel size declared in S801, allocate space for the pixels in the iBootim structure declared in S70. The size of the space is width * height * pixel size.

[0118] S803: Write the image data extracted in S40 into the space allocated for pixels in S802, continue extracting until the end of the PNG file, and then release the memory associated with PNG_INFO.

[0119] S804: Declare an iBootimHeader structure as described in S30, and initialize the iBootimHeader structure with the data in the iBootim structure in S803.

[0120] S805: Based on the width, height, and pixel size of the iBootim structure in S803, calculate the size of the uncompressed data, and allocate a space for the iBootimHeader structure to store the compressed data according to the calculated size.

[0121] S806: Based on the LZSS compression algorithm, compress the uncompressed data and store it in the space allocated by S805.

[0122] Furthermore, the following steps can be performed at 107:

[0123] 1071. Calculate the uncompressed data size of the image data, and allocate a decompression address based on the uncompressed data size;

[0124] 1072. According to the preset LZSS decompression algorithm, the pixel data of the image data is decompressed to obtain decompressed data;

[0125] 1073. Store the decompressed data in the decompression address, update the iBootim structure of the image data, and obtain the updated iBootim structure data.

[0126] In steps 1071-1073, S901: As described in S30, we have extracted the signature, compression type, color space, width, height, X-axis offset, Y-axis offset, compression size, and other information of the iBootim image.

[0127] S902: Based on the width and height extracted in S30, we can calculate the number of pixels in the iBootim image. Based on the color space extracted in S30, we can extract the pixel size of the iBootim image.

[0128] S903: In S30, we have already extracted the size of the compressed data of the iBootim image. Based on this size, we allocate a space and then extract the compressed data from the iBootim image into this space for storage. After extracting the compressed data, we no longer need to extract the iBootim image and can close the program. We can compare the size of the extracted data with the size of the compressed data extracted in S30 to determine whether the data extraction was correct.

[0129] S904: Using the number and size of pixels extracted in S902, the size of the uncompressed iBootim data can be calculated. After calculating the size of the uncompressed data, a space is allocated to store the subsequently decompressed data. The LZSS decompression algorithm is used to save the compressed and decompressed iBootim image data into the allocated space.

[0130] S905: As described in S70, declare an iBootim structure and initialize the iBootim structure using the width and height extracted in S902; the X-axis offset, Y-axis offset, compression type, and color space extracted in S30; and the decompressed data saved in S904.

[0131] Furthermore, the following steps can be performed on 108:

[0132] 1081. According to the updated iBootim structure data, the png_set_IHDR() function of the pre-built libpng library is used to set the PNG_IHDR block data to obtain the PNG_INFO structure data;

[0133] 1082. Based on the png_set_rows() function, the updated iBootim structure data is written into the PNGINFO structure to obtain the converted data.

[0134] In steps 1081-1082, S1101: Based on the color space, width, and height of the iBootim structure initialized in S905, the png_set_IHDR() function from the open-source library libpng is used to set the PNG_IHDR block information. S1102: The png_set_rows() function is used to put the image data into the PNG_INFO structure.

[0135] Furthermore, the following steps can be performed on 109:

[0136] 1091. When the image data is in PNG format, the fwrite() function is used to write the converted data to a preset folder to obtain the saved data;

[0137] 1092. When the image data is in iBootim format, the png_write_png() function is used to write the converted data into a preset folder to obtain the saved data.

[0138] In steps 1091-1092, S1201: If the image passed by the user is of type PNG, then the data in the iBootimHeader structure declared in S80 is written to the converted image file in S10 using the fwrite() function. S1202: If the image passed by the user is of type iBootim, then the data in the PNG_INFO structure declared in S110 is written to the converted image file in S10 using the png_write_png() function.

[0139] In this embodiment of the invention, third-party products or tools can quickly and easily convert PNG images to iBootim images, or convert iBootim images to PNG images. It also enables third-party products or tools to quickly and easily display their brand logo images on Apple device interfaces, solving the technical problem that common images cannot be converted to the iBootim image format.

[0140] The above describes the method for converting between iBootim images and PNG images in embodiments of the present invention. The following describes the apparatus for converting between iBootim images and PNG images in embodiments of the present invention. Please refer to [link to relevant documentation]. Figure 2 One embodiment of the present invention provides a device for converting between iBootim images and PNG images. The device includes:

[0141] The receiving module 201 is used to receive image data to be converted;

[0142] The first judgment module 202 is used to determine whether the image data is in PNG format;

[0143] The first update module 203 is used to extract feature data of the image data if it is in PNG format, modify the feature data to obtain corrected feature data, and update the corrected feature data to the PNG INFO structure of the image data to obtain updated PNG INFO structure data.

[0144] The first writing module 204 is used to initialize the iBootim attributes to construct the iBootim structure, and write the updated PNGINFO structure data into the iBootim structure to obtain the converted data;

[0145] The second judgment module 205 is used to determine whether the image data is in iBootim format if it is not in PNG format;

[0146] The information sending module 206 is used to send an image error message to the preset management port if the image is not in iBootim format.

[0147] The second update module 207 is used to initialize the iBootim structure of the image data, decompress the pixel data of the image data, update the iBootim structure of the image data, and obtain updated iBootim structure data if the format is iBootim.

[0148] The second writing module 208 is used to initialize the PNG INFO attribute to construct a PNG INFO structure, and write the updated iBootim structure data into the PNG INFO structure to obtain the converted data;

[0149] The saving module 209 is used to write the converted data into a preset folder to obtain the saved data.

[0150] Specifically, the second judgment module 205 is used for:

[0151] Construct the iBootimHeader structure;

[0152] The image data is opened in read-only mode, the binary header data of the image data is extracted, and the binary header data is used to update the iBootimHeader structure to obtain iBootim analysis data.

[0153] Determine whether the size of the iBootim analysis data is consistent with that of the iBootimHeader structure;

[0154] If the sizes are inconsistent, it is confirmed that the image data is not in iBootim format;

[0155] If the sizes are the same, then read the signature data of the iBootim analysis data and determine whether the signature data is consistent with the iBootim field;

[0156] If the characters are inconsistent, it is confirmed that the image data is not in iBootim format;

[0157] If the fields match, then read the compression type field of the iBootim analysis data and determine whether the compression type field has a valid value;

[0158] If no valid value is found, it is confirmed that the image data is not in iBootim format;

[0159] If a valid value exists, the color space data of the iBootim analysis data is read, and it is determined whether there are invalid values ​​in the color space data.

[0160] If an invalid value exists, it is confirmed that the image data is not in iBootim format;

[0161] If no invalid values ​​are found, the image data is confirmed to be in iBootim format.

[0162] Specifically, the first update module 203 is used for:

[0163] Read the feature data of the image data, detect the byte depth and color type of the feature data, and obtain the detection result;

[0164] Based on the detection results, the feature data is transformed to obtain corrected feature data.

[0165] Specifically, the first writing module 204 is used for:

[0166] Based on the aforementioned feature data, the compressed size, color type, and pixel size of the iBootim attributes are defined to obtain the pixel allocation space of the iBootim structure;

[0167] Write the updated PNG INFO structure data into the pixel allocation space of the iBootim structure, and release the memory corresponding to the updated PNG INFO structure data to obtain the initial iBootim structure data;

[0168] Based on the preliminary iBootim structure data, a pre-defined iBootimHeader structure is declared, resulting in the preliminary iBootimHeader structure;

[0169] Based on the uncompressed data size of the initial iBootim structure data, the initial iBootimHeader structure is written into the initial iBootim structure data to obtain the converted data.

[0170] Specifically, the second update module 207 is used for:

[0171] Calculate the uncompressed size of the image data, and allocate a decompression address based on the uncompressed size;

[0172] According to the preset LZSS decompression algorithm, the pixel data of the image data is decompressed to obtain decompressed data;

[0173] The decompressed data is stored in the decompression address, and the iBootim structure of the image data is updated to obtain the updated iBootim structure data.

[0174] Specifically, the second writing module 208 is used for:

[0175] Based on the updated iBootim structure data, the png_set_IHDR() function of the pre-built libpng library is used to set the PNG_IHDR block data to obtain the PNG_INFO structure data;

[0176] Based on the png_set_rows() function, the updated iBootim structure data is written into the PNG INFO structure to obtain the converted data.

[0177] Specifically, the storage module 209 is used for:

[0178] When the image data is in PNG format, the fwrite() function is used to write the converted data to a preset folder to obtain the saved data;

[0179] When the image data is in iBootim format, the png_write_png() function is used to write the converted data to a preset folder to obtain the saved data.

[0180] In this embodiment of the invention, third-party products or tools can quickly and easily convert PNG images to iBootim images, or convert iBootim images to PNG images. It also enables third-party products or tools to quickly and easily display their brand logo images on Apple device interfaces, solving the technical problem that common images cannot be converted to the iBootim image format.

[0181] above Figure 2 The iBootim image and PNG image conversion device in this embodiment of the invention is described in detail from the perspective of modular functional entities. The iBootim image and PNG image conversion device in this embodiment of the invention is described in detail from the perspective of hardware processing.

[0182] Figure 3 This is a schematic diagram of the structure of an iBootim image and PNG image conversion device 300 provided in an embodiment of the present invention. The iBootim image and PNG image conversion device 300 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 310 (e.g., one or more processors) and a memory 320, and one or more storage media 330 (e.g., one or more mass storage devices) for storing application programs 333 or data 332. The memory 320 and storage media 330 can be temporary or persistent storage. The program stored in the storage media 330 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the iBootim image and PNG image conversion device 300. Furthermore, the processor 310 may be configured to communicate with the storage media 330 and execute the series of instruction operations in the storage media 330 on the iBootim image and PNG image conversion device 300.

[0183] The iBootim image and PNG image conversion device 300 may also include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input / output interfaces 360, and / or one or more operating systems 331, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 3 The illustrated iBootim image and PNG image conversion device structure does not constitute a limitation on the iBootim image and PNG image conversion device, which may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.

[0184] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when the instructions are executed on a computer, cause the computer to perform the steps of the method for converting between iBootim images and PNG images.

[0185] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0186] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

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

Claims

1. A method for mutual conversion between iBootim images and PNG images, characterized in that, Including the following steps: Receive image data to be converted; Determine whether the image data is in PNG format; If it is in PNG format, the feature data of the image data is extracted, the feature data is modified to obtain corrected feature data, and the corrected feature data is updated to the PNG INFO structure of the image data to obtain updated PNG INFO structure data. The iBootim structure is constructed by initializing the iBootim properties, and the updated PNG INFO structure data is written into the iBootim structure to obtain the converted data; If it is not in PNG format, then determine whether the image data is in iBootim format; If the image is not in iBootim format, an image error message will be sent to the preset management port. If it is in iBootim format, then initialize the iBootim structure of the image data, decompress the pixel data of the image data, update the iBootim structure of the image data, and obtain the updated iBootim structure data; The PNG INFO property is initialized to construct a PNG INFO structure, and the updated iBootim structure data is written into the PNGINFO structure to obtain the converted data; The converted data is written to a preset folder to obtain the saved data; Specifically, the initialization of the iBootim attribute constructs the iBootim structure, and the updated PNG INFO structure data is written into the iBootim structure to obtain the converted data, including: Based on the aforementioned feature data, the compressed size, color type, and pixel size of the iBootim attributes are defined to obtain the pixel allocation space of the iBootim structure; Write the updated PNG INFO structure data into the pixel allocation space of the iBootim structure, and release the memory corresponding to the updated PNG INFO structure data to obtain the initial iBootim structure data; Based on the preliminary iBootim structure data, a pre-defined iBootimHeader structure is declared, resulting in the preliminary iBootimHeader structure; Based on the uncompressed data size of the preliminary iBootim structure data, the preliminary iBootimHeader structure is written into the preliminary iBootim structure data to obtain the converted data; Specifically, the initialization of the PNG INFO attribute constructs a PNG INFO structure, and the updated iBootim structure data is written into the PNG INFO structure to obtain the converted data, including: Based on the updated iBootim structure data, the png_set_IHDR() function of the pre-built libpng library is used to set the PNG_IHDR block data to obtain the PNG_INFO structure data; Based on the png_set_rows() function, the updated iBootim structure data is written into the PNG INFO structure to obtain the converted data.

2. The method for mutual conversion between iBootim images and PNG images according to claim 1, characterized in that, The step of determining whether the image data is in iBootim format includes: Construct the iBootimHeader structure; The image data is opened in read-only mode, the binary header data of the image data is extracted, and the binary header data is used to update the iBootimHeader structure to obtain iBootim analysis data. Determine whether the size of the iBootim analysis data is consistent with that of the iBootimHeader structure; If the sizes are inconsistent, it is confirmed that the image data is not in iBootim format; If the sizes are the same, then read the signature data of the iBootim analysis data and determine whether the signature data is consistent with the iBootim field; If the characters are inconsistent, it is confirmed that the image data is not in iBootim format; If the fields match, then read the compression type field of the iBootim analysis data and determine whether the compression type field has a valid value; If no valid value is found, it is confirmed that the image data is not in iBootim format; If a valid value exists, the color space data of the iBootim analysis data is read, and it is determined whether there are invalid values ​​in the color space data. If an invalid value exists, it is confirmed that the image data is not in iBootim format; If no invalid values ​​are found, the image data is confirmed to be in iBootim format.

3. The method for mutual conversion between iBootim images and PNG images according to claim 1, characterized in that, The step of extracting feature data from the image data and modifying the feature data to obtain corrected feature data includes: Read the feature data of the image data, detect the byte depth and color type of the feature data, and obtain the detection result; Based on the detection results, the feature data is transformed to obtain corrected feature data.

4. The method for mutual conversion between iBootim images and PNG images according to claim 1, characterized in that, The process of initializing the iBootim structure of the image data, decompressing the pixel data of the image data, and updating the iBootim structure of the image data to obtain the updated iBootim structure data includes: Calculate the uncompressed size of the image data, and allocate a decompression address based on the uncompressed size; According to the preset LZSS decompression algorithm, the pixel data of the image data is decompressed to obtain decompressed data; The decompressed data is stored in the decompression address, and the iBootim structure of the image data is updated to obtain the updated iBootim structure data.

5. The method for mutual conversion between iBootim images and PNG images according to claim 1, characterized in that, The step of writing the converted data into a preset folder to obtain the saved data includes: When the image data is in PNG format, the fwrite() function is used to write the converted data to a preset folder to obtain the saved data; When the image data is in iBootim format, the png_write_png() function is used to write the converted data to a preset folder to obtain the saved data.

6. A device for converting between iBootim images and PNG images, characterized in that, The iBootim image and PNG image conversion device includes: The receiving module is used to receive the image data to be converted; The first judgment module is used to determine whether the image data is in PNG format; The first update module is used to extract feature data of the image data if it is in PNG format, modify the feature data to obtain corrected feature data, and update the corrected feature data into the PNGINFO structure of the image data to obtain updated PNG INFO structure data. The first writing module is used to initialize the iBootim attribute to construct the iBootim structure, and write the updated PNG INFO structure data into the iBootim structure to obtain the converted data; The second judgment module is used to determine whether the image data is in iBootim format if it is not in PNG format; The information sending module is used to send image error information to the preset management port if the image is not in iBootim format. The second update module is used to initialize the iBootim structure of the image data if it is in iBootim format, decompress the pixel data of the image data, update the iBootim structure of the image data, and obtain updated iBootim structure data. The second writing module is used to initialize the PNG INFO attribute to construct a PNG INFO structure, and write the updated iBootim structure data into the PNG INFO structure to obtain the converted data; A save module is used to write the converted data into a preset folder to obtain the saved data; Specifically, the first writing module is used for: Based on the aforementioned feature data, the compressed size, color type, and pixel size of the iBootim attributes are defined to obtain the pixel allocation space of the iBootim structure; Write the updated PNG INFO structure data into the pixel allocation space of the iBootim structure, and release the memory corresponding to the updated PNG INFO structure data to obtain the initial iBootim structure data; Based on the preliminary iBootim structure data, a pre-defined iBootimHeader structure is declared, resulting in the preliminary iBootimHeader structure; Based on the uncompressed data size of the preliminary iBootim structure data, the preliminary iBootimHeader structure is written into the preliminary iBootim structure data to obtain the converted data; Specifically, the second writing module is used for: Based on the updated iBootim structure data, the png_set_IHDR() function of the pre-built libpng library is used to set the PNG_IHDR block data to obtain the PNG_INFO structure data; Based on the png_set_rows() function, the updated iBootim structure data is written into the PNG INFO structure to obtain the converted data.

7. A device for converting between iBootim images and PNG images, characterized in that, The iBootim image and PNG image conversion device includes: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor invokes the instructions in the memory to cause the iBootim image and PNG image conversion device to perform the iBootim image and PNG image conversion method as described in any one of claims 1-5.

8. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the method for mutual conversion between iBootim images and PNG images as described in any one of claims 1-5.