cancel
Showing results for 
Search instead for 
Did you mean: 

DynamicBitmapCreateExternal() for RGB565

Priyank
Senior

Hi, I am creating a DynamicBitmapCreateExternal() for RGB565, but the image shows up faded. Is there any fix for this? I made sure to set cache for it. I also tried for L8 and it didn't show.

12 REPLIES 12
GaetanGodart
ST Employee

Hello @Priyank ,

 

If the image looks faded / pastel color / lighter color, perhaps it is a color format issue.

Can you please share more information with us?

Are you able to make a "regular" DynamicBitmap work?

Can you share your code and images of the result and expected result?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Yes, it works with regular dynamic bitmap.

FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
    : FrontendApplicationBase(m, heap)
{
	static uint16_t cacheSize[512];
    Bitmap::setCache(cacheSize, sizeof(cacheSize),1);
}
void LandingView::setupScreen()
{
bmpId = Bitmap::dynamicBitmapCreateExternal(146, 36,(void*)0x90FC0000, Bitmap::RGB565);
logo.setBitmap(Bitmap(bmpId));
add(logo);
logo.setXY(20,20);
}

 The address is where I have the image stored (QSPI). This code worked when using a regular bitmap cache and dynamic bitmap create. Logo here is a Image widget.

Ok great!

Do you specifically need to use DynamicBitmapCreateExternal() or is DynamicBitmap enough?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

The situation is that there is limited Ram Capacity, and the DynamicBitmapCreateExternal function allows for an image stored in flash to be displayed at runtime so the goal was to use that. I wanted to avoid carving out x KB of RAM for an image when it can be read from flash.

Hello @Priyank ,

 

Going back to your initial question, someone offers a workaround in this thread : https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/dynamicbitmapcreateexternal-does-not-work-for-a-rgb565-image/m-p/605117/highlight/true#M35160

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hello @GaetanGodart .

Thank you for the workaround. However, it still uses up RAM. I want to read externally. User must still setCache to size of image in the workaround.

Hello @Priyank ,

 

You said "DynamicBitmapCreateExternal function allows for an image stored in flash to be displayed at runtime" but any image can be stored in flash and be displayed at runtime.
The DynamicBitmapCreateExternal function is designed to load different assets that the Bitmap data base is not aware of, this is used when people what to create a single application but have different versions of it, for instance for different regions where the assets would be different (text, font, etc).

However, if you just want to display an image (image = bitmap) from flash, you have nothing special to do, just flash that image to external flash.

Can you explain what you want to do exactly?

Do you want to create a new image (by taking a picture for instance) and display that image?

 

Also, can you try to use another format than RGB565 and see if it works?

 

Regards,

Hello @GGODA

The current use case is that the application will have a Logo displayed on multiple screens. However, each user should be able to upload their own logo and have that display (at run time). So this image which is uploaded will be converted to RGB565 and flashed to external QSPI. Bitmap Database will not have any knowledge of this image. I want to be able to display the users Logo at runtime. I tried the L8 format and it did not work at all. Regular 565 showed up faded. The workaround @GaetanGodart provided works, however it uses up the RAM to create the dynamic bitmap.

I just tried with RGB888 and it worked.