cancel
Showing results for 
Search instead for 
Did you mean: 

Touch GFX image converter

Snowcone_engineer
Associate II

 

I purchased the X-NUCLEO-GFX01M2 with the Nucleo-L476RG eval board.
The example project "Hello World" came with six image files (Image1.h - Image6.h).
This project built okay, and the canned images appeared correctly.
Next, I tried to use my own images instead of the canned images. The images list array must be modified to match the width and height of each new image used.
The following are problems that I encountered, or extra tasks required:
1) My images are JPG format, but Touch GFX only accepts PNG or SVG. I had to use Photoshop to convert them.
2) The images next had to be cropped and resized for the LCD display.
3) Touch GFX was next used to generate the proper image string array files for the project in place of the Image1-6.h files.
4) Even though the original "Hello World" image files were .H files, and 16-bit (word) arrays, Touch GFX generated .CPP 8-bit (byte) arrays. This also made the text files almost twice as large as a word array file (0x12, 0x34 vs. 0x1234).
5) Since my project is written in 'C', not "CPP", I had to edit the generated files from Touch GFX.
It would be very helpful if Touch GFX could input JPG files and generate the required word array .H files.
A previous project I tried could even render BMP files directly using included image library functions.

This post is more of an update request for the Touch GFX application.

Thank you!
 

 

3 REPLIES 3
Osman SOYKURT
ST Employee

Hello @Snowcone_engineer,

We thank you for our feedback. Here are some answers I can give already:

1- Yes, TouchGFX only accepts PNG and SVG as images natively. However JPEG images could also be used with the LibJPEG : we have a example shared in this page that you can look at. 
2- We have a better control of resizing an image when it's used with the texture mapper widget and not a regular image widget.
3- I'm not sure what you mean. Could you clarify this point?
4- I'll try to check on that.
5- TouchGFX is indeed generating C++ code, and we do not recommend to edit the generated files. If you have to,  we advise carefulness.

Osman SOYKURT
ST Software Developer | TouchGFX
MM..1
Chief III

I mean Hello world have nothink to do with TouchGFX. 

Snowcone_engineer
Associate II

Thanks for your reply and the JPG file suggestion.

Sorry for the project confusion. I meant: "It is based on the Hello World example project within the X-CUBE-DISPLAY v3.0.0 project from ST."

See project link below.

STM32L476_LCD_Example/README.md at main · brymatPC/STM32L476_LCD_Example · GitHub

4) "Touch GFX was next used to generate the proper image string array files for the project in place of the Image1-6.h files."

What I meant here was that I loaded my PNG image files into the Touch GFX app which converted the images into .CPP files with a hex string array. Project actually using .H hex array files, so the .CPP files from Touch GFX had to be modified into .H file formats.

Example:

.CPP format generated by Touch GFX

KEEP extern const unsigned char Image2[] LOCATION_ATTRIBUTE("ExtFlashSection") = { // 240x240 RGB565 pixels.
0x2a, 0x51, ....

.H format used by the project

static const unsigned short Image2[] = { 0x2A51, ......