Image Convert Tool

Image Convert Tool is a versatile image conversion utility. It supports converting various common image formats (such as PNG, JPG, BMP, etc.) into raw RGB data in target formats. Additionally, the tool offers data compression functionality, allowing users to compress the converted raw data based on customizable settings. This workflow enables flexible conversion from multiple image formats to compressed RGB data.

Interface Description

The interface of the Image Conversion Tool is shown below:

../../_images/UI_Description.png

Image Conversion Tool Interface

  1. Import images button: Click to import all PNG, JPG, and BMP images within the selected folder and its subfolders.

  2. Convert button: After importing files and modifying conversion settings, click to start the image conversion process.

  3. Image list panel: Displays all imported folders and images.

  4. Selected image preview: Shows the currently selected image.

  5. Conversion settings panel: Displays conversion parameters for the selected image.

  6. Setting button: Click to expand configuration options, including: UI theme switching, image conversion settings, and tool information display.

  7. UI theme switch: Toggle between Light Theme and Dark Theme. Some images may show better detail in Dark Theme.

  8. Image conversion settings: Click to access the configuration page for image conversion parameters.

Image Conversion Steps

The image conversion workflow is as follows:

../../_images/Convert_Steps.png

Image Conversion Steps

  1. Open image folder to imports all PNG, JPG, and BMP images within the selected folder and its subfolders.

  2. Click Setting button to navigate to the image conversion configuration page.

    ../../_images/Setting_Default.png

    Default Settings for Image Conversion

    The Image Convert Tool provides a set of default parameters. For images without custom conversion settings, the tool will apply these default parameters, which cannot be deleted.

    Users can configure conversion parameters based on image file extensions. The Image Convert Tool will process images according to the parameters corresponding to their file suffixes.

    Taking PNG images as an example, the steps to add conversion parameters are illustrated below:

    ../../_images/Convert_Setting.png

    Adding Conversion Settings

    1. Select target format (bmp, jpg, or png).

    2. Click Add to create conversion parameters for PNG files.

    3. To remove parameters, click Delete.

    The meaning of each parameter is shown below:

    Parameter Name

    Description

    Compress

    Whether to compress

    Adaptive

    When checked, automatically performs RLE or Fastlz compression and retains the result with higher compression ratio. Manual configuration of compression parameters will be disabled if checked.

    Compress Mode

    RLE

    RLE Level

    1: RLE 1st-order compression 2: RLE 2nd-order compression

    RLE Run Length1

    Run Length parameter for 1st-order RLE compression algorithm

    RLE Run Length2

    Run Length parameter for 2nd-order RLE compression algorithm (effective when RLE Level=2)

    FastLz

    YUV_Sample_Blur

    YUV_Sample_Blur+FastLz

    Sample Mode

    YUV downsampling algorithm. Supported: YUV444, YUV422, YUV411.

    Blur Mode

    Number of bits discarded per byte (starting from LSB). Supported: 0 bit, 1 bit, 2 bit, 4 bit.

    Resize

    Whether to downscale images. Supported scaling ratios: 50%, 70%, 80%. SoC will restore resized images, but quality will be reduced if enabled.

    Lower Width

    Images wider than this value will be resized.

    Lower Height

    Images taller than this value will be resized.

    Mix Alpha Channel

    Whether to blend the alpha channel when converting RGBA to RGB/RGB565. If checked: R = R * A /255, G = G * A /255, B = B * A /255.If unchecked: Alpha channel values will be discarded.

    Scan Mode

    Horizontal

    Scan image row by row.

    Vertical

    Scan image column by column.

    Color Space

    Target color space for conversion. Supported: RGB565, RTKARGB, RTKRGAB, RGB, RGBA, BINARY, RTKARGB8565.

    Note

    RLE and FastLZ compression algorithms are very effective for images with large amounts of consecutive repeated pixel values. However, they perform poorly on images composed of complex textures or with a lot of noise, and the compressed result may even be larger than the original image.

    The global configuration parameters are shown below:

    ../../_images/Global_Setting.png

    Global Parameter Settings

    • IC Selection

      • Default: Default

      • Options: RTL8773E or RTL8773G.

    • Color Head: Whether to add header information to converted images (default: checked).Realtek SoCs require this header for image parsing and display.

    • Big Endian: The order in which the exported RGB raw data is arranged in memory

      • Unchecked: Image memory is saved as B -> G -> R -> A (low-byte to high-byte).

      • Checked: Saved as A -> R -> G -> B.

    • Bin Path: Output folder path. If empty, converted files are saved to the import folder.

    • Base Address: Flash address for writing images.

    • Prefix of Image Macro: Custom prefix for image macro definitions.

    • Suffix of Image Macro: Custom suffix for image macro definitions.

    • Whether to convert image names? Click ? to preview the .h file, as shown in the figure below:

      • No Convert: Keep original case

      • ToUpperCase: Convert to uppercase

      • ToLowerCase: Convert to lowercase

    ../../_images/H_Preview.png

    .h File Preview

  3. Convert images, execute the conversion operation according to the conversion parameters, and open the result folder after the conversion is completed.

Output Files

After conversion, the following files will be generated:

../../_images/OutPut.png

Output Files

  • resource folder, stores the converted image bin files

  • detail.xlsx, stores conversion information, including: image name, compression algorithm, original image size, converted image size, compression rate, etc.

  • image.bin, all converted bin files are spliced in 64 Byte alignment

  • wristband_pic_res.h, macro-definition file describing the storage address of all bins in flash

Bin File Structure

The structure of a single bin file is as shown below:

../../_images/Bin_Structure.png

Bin File Structure

Color Header explanation is as follows:

Color Header Explanation

Parameter Name

Parameter Description

Scan

Scanning method, 0: horizontal; 1: vertical.

Align

Whether aligned, 0: not aligned; 1: 16-pixel aligned.

Resize flag

Row and column scaling ratio, 0: no scaling; 1: scaled to 50%; 2: scaled to 70%; 3: scaled to 80%.

Compress

Whether to compress, 0: no compression; 1: compression.

RSVD

Reserved

Color Space

Value corresponding to the color space used in image conversion, see Color Space Explanation.

Width

Original image width

Height

Original image height

Version

Color Header version

RSVD

Reserved

Values corresponding to the Color Space are as follows:

Color Space Explanation

Color Space Name

Value

Description

RGB565

0

16-bit RGB mode, bits 4-0 represent Blue; bits 10-5 represent Green; bits 15-11 represent Red

ARGB8565

1

24-bit ARGB mode, bits 4-0 represent Blue; bits 9-5 represent Green; bits 14-10 represent Red; bits 23-15 represent Alpha

RGB

3

24-bit RGB mode, bits 7-0 represent Blue; bits 15-8 represent Green; bits 23-16 represent Red

ARGB

4

32-bit RGBA mode, bits 7-0 represent Blue; bits 15-8 represent Green; bits 23-16 represent Red; bits 31-24 represent Alpha

BINARY

5

Grayscale image, each pixel represented by 8 bits

RTKARGB8565

15

RTK custom 24-bit ARGB mode, A occupies 1 Byte, RGB565 collectively occupy 2 Bytes, all A stored in order first, followed by all RGB565

Compress Header explanation is shown as follows:

Compress Header Explanation

Parameter Name

Parameter Description

Algorithm

Compression algorithm, 0: RLE; 1: FastLz; 2: YUV_Sample + FastLz; 3: YUV_Sample

Feature1

Run length for 1st level RLE compression algorithm

Feature2

Run length for 2nd level RLE compression algorithm

Pixel Bytes

Byte count per pixel, 0: 2 bytes; 1: 3 bytes; 2: 4 bytes; 3: 1 byte