Skip to main content
DVill
Associate II
October 7, 2025
Solved

Manage .bmp with alpha channel

Hi,

I would like to manage .bmp (with alpha channel for transparency) stored in flash and show it as it was included in the application via Touchgfx designer.

In other words I would like to customize my application with this bitmap simply uploading the bitmap and not flashing the whole application

At the moment I am able to load from usb .bmp file and store it in a memory portion of the internal flash working as a storing device.

I understand it is possibile to manage dynamical bitmap via the useful tutorial I found in the documentation, but I don't know if it works with .bitmap with alpha channel.

Do you have any suggestion for me?

Best regards.

Davide

This topic has been closed for replies.
JohanAstrupBest answer
ST Technical Moderator
October 9, 2025

Hello @DVill.

If I understand correctly, this is not solely for development purposes. If it is, there are simpler methods to achieve this than the ones mentioned below.

As I see it, you have two options:

1. Load the image at runtime with a procedure similar to this example:
https://support.touchgfx.com/docs/development/ui-development/scenarios/loading-images-at-runtime#loading-bmp-file-example

2. Use dynamicBitmapCreateExternal:
https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_bitmap#dynamicbitmapcreateexternal
This method allows you to include a bitmap from flash that the application does not know at runtime. However, you still need to convert it to a cpp file using the TouchGFX image converter before uploading it to flash.
The advantage of this approach compared to the first one is that you do not need to allocate a bitmap cache for the entire bitmap. Instead, you only require a small cache large enough to hold the dynamic bitmap database.


Best regards,
Johan

1 reply

JohanAstrupBest answer
ST Technical Moderator
October 9, 2025

Hello @DVill.

If I understand correctly, this is not solely for development purposes. If it is, there are simpler methods to achieve this than the ones mentioned below.

As I see it, you have two options:

1. Load the image at runtime with a procedure similar to this example:
https://support.touchgfx.com/docs/development/ui-development/scenarios/loading-images-at-runtime#loading-bmp-file-example

2. Use dynamicBitmapCreateExternal:
https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_bitmap#dynamicbitmapcreateexternal
This method allows you to include a bitmap from flash that the application does not know at runtime. However, you still need to convert it to a cpp file using the TouchGFX image converter before uploading it to flash.
The advantage of this approach compared to the first one is that you do not need to allocate a bitmap cache for the entire bitmap. Instead, you only require a small cache large enough to hold the dynamic bitmap database.


Best regards,
Johan