I want to load a jpg image using touchgfx. I tried the JPEG_file_loader example but it doesn't compile either. Anybody can help me? Thanks
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-23 5:20 AM - last edited on ‎2025-07-15 2:12 AM by LouisB
void Screen1View::setupScreen()
{
FILE* f = fopen("C:\\Temp\\image.jpg", "rb");
uint16_t width, height;
JPEGFileLoader::getJPEGDimensions(f, width, height);
BitmapId bmpId;
//create dynamic bitmap matching file dimensions and in format matching LCD
if (HAL::lcd().bitDepth() == 16)
{
bmpId = Bitmap::dynamicBitmapCreate(width, height, Bitmap::RGB565);
}
else
{
bmpId = Bitmap::dynamicBitmapCreate(width, height, Bitmap::RGB888);
}
if (bmpId != BITMAP_INVALID)
{
//Succesfully created, load JPEG file to bitmap
JPEGFileLoader::readJPEGFile(Bitmap(bmpId), f, lineBuffer);
}
//Image shall show the loaded bitmap
image.setBitmap(Bitmap(bmpId));
//Position image and add to View
image.setXY(20, 20);
add(image);
Screen1ViewBase::setupScreen();
}
View more
Solved! Go to Solution.
Labels:
- Labels:
-
TouchGFX
This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION
Accepted Solutions
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-23 5:31 AM
Solved: I missed to define: uint8_t bmpCache[300 * 1024];
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-23 5:31 AM
Solved: I missed to define: uint8_t bmpCache[300 * 1024];
