{"id":14246,"date":"2023-04-04T10:33:10","date_gmt":"2023-04-04T05:03:10","guid":{"rendered":"https:\/\/fastbitlab.com\/?p=14246"},"modified":"2024-03-02T10:43:27","modified_gmt":"2024-03-02T05:13:27","slug":"stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/","title":{"rendered":"STM32-LTDC, LCD-TFT, LVGL (MCU3) Lecture 10| Converting bmp images to &#8216;C&#8217; byte array"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<div class=\"boldgrid-shortcode\" data-imhwpb-draggable=\"true\">\n\n<\/div>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 35px; border-width: 0px; line-height: 50px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><strong><span style=\"color: #000080;\">Converting bmp images to &#8216;C&#8217; byte array<\/span><\/strong><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: 0px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this article, we will understand how to store an image file in the form of a \u2018C\u2019 array in the application.<\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"font-weight: 400; color: #000000;\"><span style=\"color: #ff0000;\"><strong>How to calculate how many bytes of memory does an image consume in the computer memory?<\/strong><\/span>&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400;\">The given resolution of the bitmap image is 480&#215;270, and the pixel format of that image is ARGB8888, which means the Bit depth is 32 bits.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The total memory consumed you can easily calculate by calculating the number of pixels of that image. You just have to multiply width x height, and then the memory consumed by each pixel that is bpp divided by 8, which gives you 4&nbsp; bytes.<\/span><\/p>\n<figure id=\"attachment_14249\" aria-describedby=\"caption-attachment-14249\" style=\"width: 637px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-14249\" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/04\/Figure-1.png\" alt=\"Converting bmp images to 'C' byte array\" width=\"637\" height=\"295\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-1.png 1851w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-1-300x139.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-1-1024x474.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-1-768x356.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-1-600x278.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-1-1536x711.png 1536w\" sizes=\"(max-width: 637px) 100vw, 637px\" \/><figcaption id=\"caption-attachment-14249\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Calculation of how many bytes of memory does an image consume<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Look at Figure 1, shows 506.25KB is the total memory consumed by this image in the computer memory or on the disk. So, the computer also says the same thing and the computer says the same.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You can see that, the computer says around 506 kilobytes of memory have been consumed by this image. But, this is in the case of the BMP image.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<h2 class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #d4451e;\"><strong><span style=\"text-decoration: underline;\">BMP(Bitmap) images<\/span><\/strong><\/span><\/h2>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">&nbsp;An BMP image file contains uncompressed pixel data, hence&nbsp; consumes more space on the disk.<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">506.25KB this resolution consumes approximately half an MB, but it will not be the case if it is in JPEG format. Why? Because JPEG doesn&#8217;t store the raw pixel values. It uses some kind of image compression technique. But bitmap images generally don&#8217;t use any compression on the pixel data. It&#8217;s all uncompressed, hence it consumes more space on the disk.<\/span><\/p>\n<figure id=\"attachment_14250\" aria-describedby=\"caption-attachment-14250\" style=\"width: 622px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-14250 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/04\/Figure-2.png\" alt=\"Figure 2. BMP(Bitmap) images\" width=\"622\" height=\"259\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-2.png 1753w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-2-300x125.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-2-1024x426.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-2-768x320.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-2-600x250.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-2-1536x640.png 1536w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><figcaption id=\"caption-attachment-14250\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. BMP(Bitmap) images<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"font-weight: 400; color: #000000;\">The advantage of using bitmap images is you can directly read the pixel values and display them on the display module.<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You can just send those bytes to the display module and the display module will display that. That means, there is a one-to-one relation between the pixel and the pixel value.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">But, you cannot directly read and display the .jpg file contents on the display module. You need a JPEG decoder in between.<\/span><\/p>\n<figure id=\"attachment_14251\" aria-describedby=\"caption-attachment-14251\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-14251\" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/04\/Figure-3.png\" alt=\"Converting bmp images to 'C' byte array\" width=\"620\" height=\"287\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-3.png 1841w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-3-300x139.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-3-1024x473.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-3-768x355.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-3-600x277.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-3-1536x710.png 1536w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><figcaption id=\"caption-attachment-14251\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Need in between is a JPEG decoder<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You first have to feed that pixel data to the JPEG decoder and then it gives you the bitmap data and then you can display that on the display module, as shown in Figure 3.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">JPEG decoder can be used in your application in two ways.&nbsp;<\/span><\/p>\n<ol class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li><span style=\"font-weight: 400; color: #000000;\">JPEG decoder middleware: There are a lot of open-source JPEG decoder implementations.<\/span><\/li>\n<li><span style=\"font-weight: 400; color: #000000;\">JPEG decoder peripheral of the MCU<\/span><\/li>\n<\/ol>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You can even use that peripheral to decode the JPEG contents. So, even STM32 microcontrollers support JPEG Decoder IP on the microcontroller.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\">&nbsp;<\/p>\n<h3 class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"text-decoration: underline; color: #d4451e;\"><b>Storing Images in the application<\/b><\/span><\/h3>\n<ol class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Convert the images to bitmap &#8216;C&#8217;&nbsp; array(pixel value array) with desired pixel format.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Once you get the &#8216;C&#8217; array, you store them in the internal flash memory of your microcontroller.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Use the appropriate pixel format to display that information on the display module. <\/span><\/li>\n<\/ol>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #ff0000;\"><strong>How to convert the images to a bitmap &#8216;C&#8217; array?<\/strong><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">There are a lot of online tools available to do this. You can use this online image converter tool available on the <\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/lvgl.io\/\"><span style=\"font-weight: 400;\">LVGL<\/span><\/a><\/span><span style=\"font-weight: 400;\"> website.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In LVGL, just go to tools and go to image converter, as shown in Figure 4.<\/span><\/p>\n<figure id=\"attachment_14252\" aria-describedby=\"caption-attachment-14252\" style=\"width: 632px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14252 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/04\/Figure-4.png\" alt=\"Figure 4. LVGL website\" width=\"632\" height=\"364\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4.png 1537w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4-300x173.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4-1024x590.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4-768x442.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4-600x345.png 600w\" sizes=\"(max-width: 632px) 100vw, 632px\" \/><figcaption id=\"caption-attachment-14252\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. LVGL website<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400;\">After that, in the image file section, you can upload any image.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400;\">After that, you can select the color format or pixel format. You can just keep this as &#8216;True color&#8217;;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400;\">Then you can mention the Output format is a &#8216;C&#8217; array.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400;\">And then you need not use this big-endian format because the microcontroller uses little-endian convention<span style=\"color: #000000;\">.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After that you click on Convert. <\/span><\/p>\n<figure id=\"attachment_14253\" aria-describedby=\"caption-attachment-14253\" style=\"width: 579px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14253 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/04\/Figure-5.png\" alt=\"Figure 5. Online image converter\" width=\"579\" height=\"271\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-5.png 1495w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-5-300x140.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-5-1024x479.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-5-768x359.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-5-600x281.png 600w\" sizes=\"(max-width: 579px) 100vw, 579px\" \/><figcaption id=\"caption-attachment-14253\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Online image converter<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #d4451e;\"><b>Selecting pixel format for your application<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">That depends on,<\/span><\/p>\n<ol class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Pixel format supported by the LCD Driver chip.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Desired color range&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Microcontrollers RAM space availability&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Microcontroller Flash space availability&nbsp; <\/span><\/li>\n<\/ol>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s see one example.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Consider our original image pixel format as ARGB8888. But, the same pixel format we cannot use in our application when we are using the STM32F429IDISCOVERY board. <\/span><\/p>\n<figure id=\"attachment_14254\" aria-describedby=\"caption-attachment-14254\" style=\"width: 621px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14254 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/04\/Figure-6.png\" alt=\"Figure 6. STM32F429IDISCOVERY board\" width=\"621\" height=\"312\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-6.png 1603w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-6-300x151.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-6-1024x514.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-6-768x386.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-6-600x301.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-6-1536x771.png 1536w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><figcaption id=\"caption-attachment-14254\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. STM32F429IDISCOVERY board<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Why?&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Because, this board has a display module, which uses the LCD driver Chip ILI9341. And ILI9341 driver chip supports RGB565\/RGB666\/RGB222 pixel formats only. It doesn&#8217;t support RGB888 or ARGB8888.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here we select the RGB565 pixel format in our application. That means, 1 pixel consumes 2 bytes. That&#8217;s why, the total flash consumed for 3 frames because we have got three frames in the application. So, here the number of pixels is 320&#215;240, 2 bytes per pixel, and the number of frames is 3, which gives you 450KiB. So, the total flash memory consumed is 450 kilobytes.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">But, we have got&nbsp; 2MB of On-chip Flash on this microcontroller. That&#8217;s why 450KiB will not be an issue.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s analyze the same thing for the STM32F746GDISCOVERY board.&nbsp;<\/span><\/p>\n<figure id=\"attachment_14255\" aria-describedby=\"caption-attachment-14255\" style=\"width: 587px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14255 \" src=\"https:\/\/fastbitlab.com\/wp-content\/uploads\/2023\/04\/Figure-7.png\" alt=\"Figure 7. STM32F746GDISCOVERY board\" width=\"587\" height=\"276\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-7.png 1505w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-7-300x141.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-7-1024x481.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-7-768x361.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-7-600x282.png 600w\" sizes=\"(max-width: 587px) 100vw, 587px\" \/><figcaption id=\"caption-attachment-14255\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. STM32F746GDISCOVERY board<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here, the LCD Driver is&nbsp; OTA5180A, and it supports up to RGB888 Pixel formats. Because, between the microcontroller and display module, there are 24 data lines. That&#8217;s why, it supports up to RGB888 Pixel formats.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If you use RGB888 in your application, 1 pixel consumes 3 bytes. The total flash space consumed for 3 frames will be, here the resolution is 480&#215;270 and into 3, and 3. This would become like 1.1 MB. But the total on-chip Flash on the microcontroller is just 1MB. That&#8217;s why your application won&#8217;t compile here. You should make sure that the total flash space consumed is less than this 1MB. This is just a flash space consumed by frames. That&#8217;s why these frames will not fit into the internal flash of the microcontroller.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px;\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 23px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; border-width: 0px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span><span style=\"color: #0000ff;\">&nbsp;<\/span><\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Converting bmp images to &#8216;C&#8217; byte array &nbsp; In this article, we will understand how to store an image file in the form of a \u2018C\u2019 array in the application. &nbsp; How to calculate how many bytes of memory does an image consume in the computer memory?&nbsp; The given resolution of the bitmap image [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":14252,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"enable","ocean_disable_heading":"default","ocean_post_title":"Converting bmp images to 'C' byte array","ocean_post_subheading":"","ocean_post_title_style":"solid-color","ocean_post_title_background_color":"#07409b","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[],"class_list":["post-14246","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Convert bmp images to &#039;C&#039; byte array | FastBit EBA<\/title>\n<meta name=\"description\" content=\"Converting bmp images to &#039;C&#039; byte array. How to calculate how many bytes of memory does an image consume in the computer memory? The given\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Convert bmp images to &#039;C&#039; byte array | FastBit EBA\" \/>\n<meta property=\"og:description\" content=\"Converting bmp images to &#039;C&#039; byte array. How to calculate how many bytes of memory does an image consume in the computer memory? The given\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-04T05:03:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-02T05:13:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1537\" \/>\n\t<meta property=\"og:image:height\" content=\"885\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"STM32-LTDC, LCD-TFT, LVGL (MCU3) Lecture 10| Converting bmp images to &#8216;C&#8217; byte array\",\"datePublished\":\"2023-04-04T05:03:10+00:00\",\"dateModified\":\"2024-03-02T05:13:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/\"},\"wordCount\":1054,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Figure-4.png\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/\",\"name\":\"Convert bmp images to 'C' byte array | FastBit EBA\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Figure-4.png\",\"datePublished\":\"2023-04-04T05:03:10+00:00\",\"dateModified\":\"2024-03-02T05:13:27+00:00\",\"description\":\"Converting bmp images to 'C' byte array. How to calculate how many bytes of memory does an image consume in the computer memory? The given\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Figure-4.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/Figure-4.png\",\"width\":1537,\"height\":885,\"caption\":\"Figure 4. LVGL website\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"STM32-LTDC, LCD-TFT, LVGL (MCU3) Lecture 10| Converting bmp images to &#8216;C&#8217; byte array\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Convert bmp images to 'C' byte array | FastBit EBA","description":"Converting bmp images to 'C' byte array. How to calculate how many bytes of memory does an image consume in the computer memory? The given","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/","og_locale":"en_US","og_type":"article","og_title":"Convert bmp images to 'C' byte array | FastBit EBA","og_description":"Converting bmp images to 'C' byte array. How to calculate how many bytes of memory does an image consume in the computer memory? The given","og_url":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2023-04-04T05:03:10+00:00","article_modified_time":"2024-03-02T05:13:27+00:00","og_image":[{"width":1537,"height":885,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"STM32-LTDC, LCD-TFT, LVGL (MCU3) Lecture 10| Converting bmp images to &#8216;C&#8217; byte array","datePublished":"2023-04-04T05:03:10+00:00","dateModified":"2024-03-02T05:13:27+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/"},"wordCount":1054,"commentCount":1,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4.png","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/","url":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/","name":"Convert bmp images to 'C' byte array | FastBit EBA","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4.png","datePublished":"2023-04-04T05:03:10+00:00","dateModified":"2024-03-02T05:13:27+00:00","description":"Converting bmp images to 'C' byte array. How to calculate how many bytes of memory does an image consume in the computer memory? The given","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2023\/04\/Figure-4.png","width":1537,"height":885,"caption":"Figure 4. LVGL website"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/stm32-ltdc-lcd-tft-lvgl-mcu3-lecture-10-converting-bmp-images-to-c-byte-array\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"STM32-LTDC, LCD-TFT, LVGL (MCU3) Lecture 10| Converting bmp images to &#8216;C&#8217; byte array"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/14246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=14246"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/14246\/revisions"}],"predecessor-version":[{"id":16300,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/14246\/revisions\/16300"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/14252"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=14246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=14246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=14246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}