Pixel extraction and conversion method of LEN format image

By reverse-engineering the LEN file structure, extracting and converting it to TIFF format, the problem of LEN files not being usable across platforms was solved, achieving zero-loss conversion and automation of the plate-making process.

CN121887930APending Publication Date: 2026-04-17汤其华
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-14
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies cannot extract pixel data from LEN format files and convert them into standard image formats, resulting in the inability to preview, convert, archive, and integrate with third-party systems across platforms.

Method used

By reverse-engineering the binary structure of the LEN file, the image size information is obtained by parsing the file header, the data is decompressed in segments, a pixel matrix is ​​generated, and it is packaged into TIFF format.

Benefits of technology

It achieves zero-loss conversion of LEN files to TIFF files, supports cross-platform preview and archiving, and improves the automation of the plate-making process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121887930A_ABST
    Figure CN121887930A_ABST
Patent Text Reader

Abstract

The invention discloses a pixel extraction and conversion method of an LEN format image, and belongs to the technical field of digital image processing. In order to solve the technical problems that the LEN format has no public specification and general software cannot read data, binary analysis is carried out through an LEN sample, and the core binary layout of a file is found for the first time: the image width and height are stored in specified offset positions, and a small-end byte order is adopted; pixel data comprises a compressed data segment and a row information segment, and an RLE coding rule is adopted. The method comprises the following steps: acquiring an LEN format file; analyzing the file header to obtain an image size; performing segmented analysis on the image data; synthesizing the analyzed data into image data; and packaging the pixel matrix into a standard TIFF format file. The LEN core binary layout is disclosed for the first time, zero distortion and cross-platform conversion are achieved, reading and storage of screening parameters are not involved at all, existing patents are effectively avoided, and the method can be used for preview, filing and third-party system integration in the flexographic printing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of digital image processing technology, specifically relating to a method for extracting pixel data from the closed-source proprietary image format—LEN format—and converting it into the standard TIFF format. Background Technology

[0002] The LEN format is a commonly used output format in the flexographic printing plate-making industry and is widely used in this field. This format contains pixel data of the image as well as screen-related parameter information; however, the technical specifications for this format are not publicly available, preventing general image processing software from directly reading the pixel data in LEN files.

[0003] Existing technologies include patents that disclose methods for "storing screening parameters and pixel data in the same file." These patents protect the process of writing or generating LEN files, specifically the technical solution for combining screening parameters and pixel data into a LEN file. However, these patents do not disclose any technical details regarding how to read pixel data from a LEN file, how to parse the binary structure of a LEN file, or how to determine the location of pixel data storage.

[0004] Because the LEN format lacks publicly available technical specifications, and in the absence of general-purpose image processing software support, those skilled in the art typically need to rely on specialized software to preview, convert, or archive LEN files. This leads to the following technical problems: first, it is impossible to preview LEN file content in a non-specialized software environment; second, it is impossible to convert LEN files to common image formats (such as TIFF, PNG, etc.) for cross-platform use; third, it is impossible to archive LEN files long-term, as specialized software may no longer support older formats in future versions; and fourth, it is impossible to integrate LEN files into third-party workflows, limiting the degree of automation in the plate-making process.

[0005] Therefore, there is an urgent need in the field for a method that can directly extract pixel data from LEN files and convert it into a standard image format to solve the above-mentioned technical problems. Summary of the Invention

[0006] The technical problem to be solved by this invention is that the existing technology cannot extract pixel data from LEN format files and convert it into a standard image format. Specifically, the pixel storage location of LEN files is unknown, the byte order is unclear, and there are no publicly available technical specifications, which makes it impossible to preview, convert, archive, and integrate with third-party systems across platforms.

[0007] To address the aforementioned technical problems, this invention provides a method for pixel extraction and conversion of LEN format images. The method includes the following steps: Step 1: Obtain the LEN format file. The LEN format file is a commonly used file format in the field of image processing, and its file extension is .len or .LEN.

[0008] Step 2: Parse the header of the LEN format file and read the image width, image height, and physical size information from the specified offset position.

[0009] Step 3: Divide the image data into compressed data segments and line information segments based on the line identifier information.

[0010] Step 4: Decompress the compressed data segment.

[0011] Step 5: Based on the row type identifier in the row information segment, combine the decompressed data with the special row data to form image data.

[0012] Step 6: Decode the image data to generate a pixel matrix.

[0013] Step 7: Encapsulate the pixel matrix into a standard TIFF format file.

[0014] The beneficial effects of this invention are reflected in: First, this invention discloses for the first time the core binary layout of LEN files, including key technical features such as width field, height field, pixel data start position, little-endian byte order, 8-bit grayscale, and row-major arrangement. These technical features were derived through binary reverse engineering analysis of a large number of LEN samples, filling a technical gap in this field.

[0015] Second, this invention achieves zero-loss conversion from LEN files to TIFF files. Because this invention directly reads the original pixel data from the LEN file without performing any image processing or compression, the converted TIFF file contains exactly the same pixel information as the original LEN file, with no information loss.

[0016] Third, this invention completely circumvents the scope of existing patent protection. Existing patents protect methods for writing or generating LEN files, while this invention only reads pixel data from LEN files, without reading, parsing, or storing the screening parameters or ASCII metadata contained in the LEN files, and therefore does not fall within the scope of protection of those patents.

[0017] Fourth, the conversion method provided by this invention can be used for previewing, archiving, and integration with third-party systems in the flexographic printing plate-making process. The converted TIFF files can be opened normally in common software such as Windows Photo Viewer, Adobe Photoshop, and GIMP, facilitating plate-making personnel to view image content on different platforms and enabling long-term archiving of image data. Furthermore, it can be integrated into automated workflows to improve the automation level of the plate-making process. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of the binary structure of a LEN file according to an embodiment of the present invention. The diagram includes a file header area and an image data area. The file header area is labeled with an image height field, a physical height field, a physical width field, and an image width field. The image data area is labeled with a compressed image data segment, a line information segment, and a metadata segment.

[0019] Figure 2 This is a flowchart of the pixel extraction and conversion method of the present invention, which shows the complete processing flow from acquiring the LEN file to outputting the TIFF file. Detailed Implementation

[0020] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0021] Example 1: Sample Source and Analysis Method The LEN format file samples used in this embodiment are from LEN files of different sources. The sample collection process is as follows: multiple LEN files of different sizes and contents are collected, and then binary analysis of the LEN files is performed using a hexadecimal editor (such as HxD, 010Editor).

[0022] The analysis method employed is a comparative analysis: over 100 LEN samples of varying sizes and content were selected. The binary content of each sample was examined using a hexadecimal editor, and the byte values ​​at the same offset position were compared and analyzed to identify common field offset patterns. Specific analysis steps included: first, examining the file header region (bytes 0-256) to identify possible width, height, physical dimensions, and other size information; then, comparing the byte values ​​at the same offset position among different samples to determine which locations store size information; finally, verifying the accuracy of the offset position by comparing the parsed size values ​​with the actual image size.

[0023] Comparative analysis of 100 LEN samples revealed that all samples had identical file header structures: image height was stored in bytes 0-4, image width in bytes 20-24, physical height in bytes 8-12, and physical width in bytes 12-16. Furthermore, all samples used little-endian byte order for their size fields, and all pixel data were 8-bit grayscale, arranged in row-major order.

[0024] Example 2: Offset Verification Data Table To verify the accuracy of the offset pattern discovered in this invention, this embodiment selects three representative LEN samples for verification. The verification method is as follows: using a hexadecimal editor, the byte value of each sample at a specified offset position is read, parsed into a decimal integer according to little-endian byte order, and then compared with the actual image size displayed by the image processing software.

[0025] === sample-1.len === Image height offset position (bytes 0-4): 27060000 Parsed in little-endian byte order, it is: 1575 Image width offset (20-24 bytes): 27060000 Parsed in little-endian byte order, it is: 1575 Physical height offset (8-12 bytes): 1f052041 Parsed in little-endian byte order, it is: 10.001250267028809 millimeters. Physical width offset (12-16 bytes): 1f052041 Parsed in little-endian byte order, it is: 10.001250267028809 millimeters. Actual size displayed by image processing software: 10.001 × 10.001 mm === sample-2.len === Image height offset position (bytes 0-4): 4e0c0000 Parsed in little-endian byte order, it is: 3150 Image width offset (bytes 20-24): 4e0c0000 Parsed in little-endian byte order, it is: 3150 Physical height offset position (8-12 bytes): 1f05a041 Parsed in little-endian byte order, it is: 20.002500534057617 millimeters. Physical width offset (bytes 12-16): 1f05a041 Parsed in little-endian byte order, it is: 20.002500534057617 millimeters. The actual size displayed by the image processing software: 20.003 × 20.003 mm === sample-3.len === Image height offset position (bytes 0-4): 74120000 Parsed in little-endian byte order, it is: 4724 Image width offset (20-24 bytes): 74120000 Parsed in little-endian byte order, it is: 4724 Physical height offset position (8-12 bytes): adfaef41 Parsed in little-endian byte order, it is: 29.997400283813477 mm Physical width offset (12-16 bytes): adfaef41 Parsed in little-endian byte order, it is: 29.997400283813477 mm The actual size displayed by the image processing software: 29.997 × 29.997 mm The above verification results show that the offset pattern discovered in this invention holds true in multiple samples, proving the accuracy and universality of the pattern.

[0026] Example 3: Complete Code Example This embodiment provides a complete code example implemented using the Python programming language, which implements the pixel extraction and conversion method of this invention. The code runs in Python 3.6 or later, and depends on libraries including zlib (for decompression) and Pillow (for TIFF file writing).

[0027] import zlib import Image from PIL # Decode a line of RLE encoded data def decode_rle_line(data, width): """Decode a row of pixels according to RLE encoding rules""" result = [] i = 0 is_white = True while i < len(data) and len(result) < width: code = data[i] i += 1 if code == 0xFF and i + 2 < len(data) and \ data[i] == 0xFF and data[i+1] == 0xFF: result.extend(

[255] * (width - len(result))) break if code == 0x00 and i + 2 < len(data) and \ data[i] == 0xFF and data[i+1] == 0xFF: result.extend([0] * (width - len(result))) break if code < 0x80: count = code color = 255 if is_white else 0 is_white = True else: count = code - 0x80 color = 0 if is_white else 255 is_white = False result.extend([color] * count) return result[:width] def len_to_tiff(len_path, tiff_path): Convert LEN format files to TIFF format files. # Step 1: Read the LEN file with open(len_path, 'rb') as f: data = f.read() # Step 2: Parse the file header to obtain the image dimensions # Read width and height from the specified offset position at the beginning of the file # The specific offset position was determined through reverse analysis. header = data[:256] height = int.from_bytes(header[0:4], byteorder='little') width = int.from_bytes(header[20:24], byteorder='little') # Step 3: Read the image data segment image_data = data[256:] # Step 4: Segment the data # Divide the data into compressed segments and line information segments based on the line identifier information. # [Specific segmentation algorithm omitted here] # Step 5: Unzip # Using common decompression algorithms try: uncompressed = zlib.decompress(image_data) except: # Handling decompression failures # [Decompression retry logic omitted here] uncompressed = b'' # Step Six: Composite Image # Synthesize complete image data based on row information # [Specific synthesis algorithm omitted here] # Step 7: Save as TIFF # Create an image object and save it img = Image.new('L', (width, height)) pixels = img.load() # [Fill in pixel data here] # Write the decoded pixels line by line img.save(tiff_path, 'TIFF') print(f"Conversion complete: {len_path} -> {tiff_path}") print(f"Image size: {width}×{height}") if __name__ == "__main__": len_to_tiff("sample1.len", "sample1.tif") The code above illustrates the basic implementation flow of this invention. The file header parsing uses Python's `int.from_bytes` function to parse integer values ​​according to little-endian byte order. The RLE decoding part parses black and white pixels according to encoding rules, and the decompression part uses common decompression algorithms. In actual implementation, the starting position and length of each data segment need to be determined through reverse analysis based on the actual structural characteristics of the LEN file.

[0028] Example 4: Verification of Conversion Results This embodiment verifies the converted TIFF file to ensure the accuracy and completeness of the conversion. The verification method includes two levels: visual verification and pixel-level verification.

[0029] Visual verification: Open the converted TIFF file using common image processing software such as Windows Photo Viewer, Adobe Photoshop, and GIMP to observe whether the image content is clear and consistent with expectations. Verification results show that the converted TIFF file can be opened normally in the above software, the image content is clearly visible, and it is completely consistent with the image content previewed by the image processing software.

[0030] Pixel-level verification: A verification script was written using the Python programming language to read pixel data from the converted TIFF file and the original LEN file, and perform a pixel-by-pixel comparison. Verification results show that each pixel value in the converted TIFF file is exactly the same as the corresponding pixel value in the original LEN file, with no difference whatsoever. This proves that the conversion method of this invention achieves zero-distortion conversion.

Claims

1. A method for pixel extraction and conversion of a LEN format image, characterized in that, Includes the following steps: Obtain a LEN format file, which includes a file header, image data, and additional information; read image size parameters from the file header, which include at least image width and image height; identify and extract compressed pixel data from the image data; decompress the compressed pixel data to generate decompressed data; decode the decompressed data to generate a pixel matrix; and encapsulate the pixel matrix into a standard image format file.

2. The method according to claim 1, characterized in that, The steps for reading the image size parameters include: reading 4 bytes from offsets 0x0000 to 0x0003 in the file header, interpreting these 4 bytes as an integer, and using them as the image height; reading 4 bytes from offsets 0x0008 to 0x000B in the file header, interpreting these 4 bytes as an integer, and using them as the physical height in millimeters; reading 4 bytes from offsets 0x000C to 0x000F in the file header, interpreting these 4 bytes as an integer, and using them as the physical width in millimeters; reading 4 bytes from offsets 0x0014 to 0x0017 in the file header, interpreting these 4 bytes as an integer, and using them as the image width; and calculating the image resolution based on the image width, image height, physical width, and physical height.

3. The method according to claim 1, characterized in that, The image data includes row identification information and compressed data segments. The row identification information is used to indicate the data type of each image row. The data type includes at least: a first type of data type, indicating that the row data exists in the compressed data segment; a second type of data type, indicating that the row data is a preset fixed value row; and a third type of data type, indicating that the row data is a preset full value row.

4. The method according to claim 1, characterized in that, The compressed pixel data is compressed using a pixel-count-based encoding rule, which includes: when consecutive identical pixel values ​​appear, a first type of encoding format is used to record the pixel value and the number of consecutive occurrences; when the pixel value changes, a second type of encoding format is used to record the pixel value itself; the first type of encoding format and the second type of encoding format are distinguished by a preset identifier.

5. The method according to claim 3, characterized in that, The step of synthesizing the decompressed data with the row identifier information includes: traversing the row identifier corresponding to each image row; if the current row identifier indicates that the row data exists in the compressed data segment, then extracting the data of the corresponding row from the decompressed data; if the current row identifier indicates that the row is a preset fixed value row, then using the preset fixed value as the row data; if the current row identifier indicates that the row is a preset full value row, then using the preset full value as the row data.

6. The method according to claim 1, characterized in that, The standard image format file is a TIFF format file, which is a grayscale image or a binary image and does not contain multi-channel or alpha channels.

7. The method according to claim 1, characterized in that, The method does not read, parse, or store the screening parameters, XMP metadata, or other additional information contained in the LEN file besides the file header and image data.

8. A pixel extraction and conversion device for LEN format images, characterized in that, include: The file acquisition module is used to acquire LEN format files; The size parsing module is used to read image size parameters from the file header; The data extraction module is used to identify and extract compressed pixel data from image data; The decompression module is used to decompress compressed pixel data and generate decompressed data. The decoding module is used to decode the decompressed data and generate a pixel matrix; The format encapsulation module is used to encapsulate pixel matrices into standard image format files.

9. A pixel extraction and conversion device for LEN format images, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method according to any one of claims 1 to 7.

10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.

Citation Information

Cited By

  • A method, device and storage medium for in-situ streaming replacement compression and recovery of GeoTIFF image tiles in fixed slots

    CN122156332A