Skip to main content
KMew
Senior III
January 20, 2023
Solved

TouchGFX: Discrepancy in File Size

  • January 20, 2023
  • 3 replies
  • 2637 views

I am using a TouchGFX generated code to display an image, but I am getting a really large file size discrepancy and I'm unsure why the difference is so large.

First, there is the image that is saved in the assets folder of the TouchGFX folders.

Resolution: 1280 x 260

Bit Depth: 32

File Size: 41.7 kBytes

However, the file size that's in the flash when I build the project is MUCH bigger

Resolution: 347 x 50

Bit Depth: Unknown

File Size: 1.27 MBytes

0693W00000Y8nkAQAR.png 

I used the scalable image widget to add the image in the TouchGFX Designer.

Am I misunderstanding this?

This topic has been closed for replies.
Best answer by MM..1

Files is coded as C source image for example

  0x00, 0x03, 0x07, 0x07,

then every pixel for example RGB565 is 11 chars = file size 347x50x11 plus som headers = ...

And FYI png is compressed format normal image 1280x260x4 for 32b is 1,3M

3 replies

MM..1
MM..1Best answer
Super User
January 21, 2023

Files is coded as C source image for example

  0x00, 0x03, 0x07, 0x07,

then every pixel for example RGB565 is 11 chars = file size 347x50x11 plus som headers = ...

And FYI png is compressed format normal image 1280x260x4 for 32b is 1,3M

KMew
KMewAuthor
Senior III
January 23, 2023

Hello MM.1

Ah, interesting. So that math aligns with a normal image. It seems they save the image in the resolution that the original image is and doesn't do the compression like the PC does. This is helpful info. Therefore, the way to minimize Flash usage is to minimize the size of the original image, not just making it smaller in the TouchGFX Designer.

Thank you MM!

MM..1
Super User
January 24, 2023
You need in images config define how you need in code , if perfect with alpha result is 4 bytes per pixel, but without alpha 3 bytes (RGB888) and paleted compresion L8 is only one byte per pixel.
Second solution is in latest 4.21 added support for SVG Tiny vector graphics...
And dont use scaled images if isnt for size animation ...