cancel
Showing results for 
Search instead for 
Did you mean: 

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

Mvill.17
Associate III
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
This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
Mvill.17
Associate III

Solved: I missed to define: uint8_t bmpCache[300 * 1024];

View solution in original post

1 REPLY 1
Mvill.17
Associate III

Solved: I missed to define: uint8_t bmpCache[300 * 1024];