Showing results for 
Search instead for 
Did you mean: 

Storing the Images in Jpeg format for displaying GIFs in STM32U5 controller

Associate II

 Storing the Images in Jpeg or png format for displaying GIFs in STM32U5 controller


 I want to display some GIFs on my STM32U5 board. Images are stored in their raw format which is bit large in size, so is it possible to store the images in JPEG format itself, so that it consuems very less format compared to storing in raw format. I have 4-5 different GIFs to be played, and the image size of those imaqes will be way too much if it is stored in its raw format. 

Is there also any possible way where I can store the images in some compressed form?

Note: I am using STm32U5A9NJ controller which has a Hardware accelerated JPEG codec in it.


ST Employee

Hello @Sgowd.1 ,


You only talk about storage but what about displaying your GIF?


First, regarding storing.
GIF uses a color palette of a maximum of 256 colors and apply LZW compression algorithm to the images. Therefore, the "raw" format of a GIF is greatly compressed already.
TouchGFX support L8 color format (the 256 color palette) as well as LZW to compress images.
So you could achieve the same result by storing each of the frames of your gifs and compressing them inside TouchGFX Designer.
JPEG will probably take more space than L8 + LZW.

"Is there also any possible way where I can store the images in some compressed form?"
I am having trouble understanding what format you currently have. Is it GIF, is it raw picture format?
If you actually have a GIF, it is already compressed.


Then, regarding displaying.

I see 4 options for you.

1) Displaying a video
Save your GIF as a video and display it using the video widget.

2) Displaying frame by frame by adding all images to TouchGFX Designer
For each one of your frames, add an image widget in Designer and simply display the one you need.

3) Display frame by frame by using a single bitmap
Add a single image widget to TouchGFX Designer and modify the content of the bitmap as you need to update your GIF.

4) Use an animated image widget
We have a widget called animated image which taxes n images name Whatever-1 to whatever-n. The widget will display each images one after the other based on the number at the end of the name and you can choose the speed at which the images changes.
I think this would be the easiest option for you.

Either way, if you use one of the options using images, you can compress those images to save space.


If this comment answers your question, I invite you to select it as "best answer".



Gaetan Godart
Software engineer at ST (TouchGFX)