cancel
Showing results for 
Search instead for 
Did you mean: 

How to read image file from SD card and display on LCD

renukaradhya
Associate II
Posted on August 07, 2015 at 08:45

Hi,

I am using STM32F103ZET6 development board interfaced with micro SD card. I am able to read and write data to the text file created in SD card using FAFTS but unable to read and display images stored in SD card on LCD display.  Can anybody suggest me how to overcome my problem and resolve the issue at earliest.  

Regards,

Aradhya 
6 REPLIES 6
Posted on August 07, 2015 at 16:05

I guess you need to start by understanding bitmap formats, and how the pixel data is encoded into the bytes within the file?

The files read just like any other stream of bytes.

You have to figure which specific formats you want to support, and then the function of your display, and the routines to plot points of colour.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
renukaradhya
Associate II
Posted on August 10, 2015 at 06:38

Hi Clive, Thanks for your response i want read images stored in bitmap format, can i get some sample codes to know the basics of the bitmap image format.

Posted on August 10, 2015 at 15:08

https://community.st.com/0D50X00009XkZvsSAF

 This thread deals with BMP images and a 320x240 panel

Compressed formats like JPEG/PNG can be significantly more complicated.The web should have plenty of material covering video displays and bitmap formats.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
renukaradhya
Associate II
Posted on August 19, 2015 at 15:12

Hi Clive, thank you for the useful information about bit map formats, understood the bit map format but have some doubt in below part i.e. what we are storing in w[i] array as per my knowledge i understood that we are converting 24 bit RGB image into 16bit RGB image, please help me out if i'm wrong on this part.

for(
i
=
0
; i<256; i++) // Build palette conversion (+0x46 count?)

{

uint32_t pal;

f_read(&fsrc, &pal, 4, &bytesread); // Read palette B G R

 // BBBBBGGGGGGRRRRR 5:6:5 

pal = ((pal & 0xF80000) >> 😎 | ((pal & 0x00FC00) >> 5) | ((pal & 0x0000F8) >> 3);

 w[i] = (uint16_t)pal; 
} 

Posted on August 19, 2015 at 16:25

Without digging through everything, I'd say this deals with an 8-bit BMP, with a 24-bit palette table, and the palette table is being reduce for the 16-bit colour depth of the display. The pixels are defined as an 8-bit index into the palette table.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
renukaradhya
Associate II
Posted on August 22, 2015 at 11:29

Thank you very much for your suggestions, now i can able to display the 24bit bit map image on LCD module, but updation of image taking more time is their any way to reduce the interval