Xinyuan-LilyGO/T-Dongle-S3

converting image to byte array

chaabanihoussem opened this issue · 2 comments

Hi

this is not an issue, it's a question since I couldn't find the tool

what tool was used to convert an image to this array here:

T-Dongle-S3/example/Factory /logo.h

Thanks

Thank you @lewisxhe for the tool.

After many trials I found out that the process to push images on the T-dongle-S3 device is this :

  1. Use MS Paint to save your image into Bitmap 24bits format (.bmp).
    - The image must have a 2:1 ratio (width must be exactly twice the height)
  2. Open this bmp file using Image2Lcd v2.9
  3. Enter the following parameters:
  • Output file type = C array
  • Scan mode = Horizontal
  • BitsPixel = 16 bits TrueColor (the first one in the list)
  • Max Width and Height = 160 x 80 (click the arrow to apply)
  • Include head data : NOT checked
  • Scan right to left : NOT checked
  • Scan bottom to top : NOT checked
  • MSB first : checked
  • "16 bit Color" tab => R:5 G:6 B:5
  1. Save the image with .h extension (the file should have about 1600 lines of 16 bytes)
    - The file name you choose will also be the variable name in your program

Then, for example, the TFT.ino example project can be modified to add the image file to the headers and to add a new case item diplaying this new image:
case N:
tft.pushImage(0, 0, 160, 80, (uint16_t *)gImage_yourimage);
break;