Language: EN

convertir-imagenes-para-arduino-con-lcd-image-conveter

Convert images for Arduino with Lcd Image Conveter

If you work with TFT, eink, LCD screens, along with microprocessors like Arduino, at some point you will need to convert an image into a byte array in order to use them.

This has the additional difficulty factor that the screens in microprocessors use different color models than the usual RGB888 (24 bits, 16 million colors), such as RG565 (16 bits, 65 thousand colors), RG332 (8 bits, 256 colors) or grayscale with a different number of bits.

There are many programs to perform the conversion but, personally, the one I like the most is Lcd Image Converter. This program is simple to use while incorporating all the functionalities that we are normally going to need.

LCD Image Converter allows you to create an empty image or, more frequently, incorporate an existing image for conversion. Available formats include the usual ones, such as JPG, BMP, GIF, TIFF, PNG, among others.

arduino-lcd-image-converter-main

We can export the image to a C array using the File/Converter command. The result is a file that contains the array along with a structure that adds the size and bit depth so that we can use it directly in our program.

    
    static const uint16_t image_data_myimage[76800] = {
        //... data ....
    };
    
    const tImage myImage = { image_data_myimage, 320, 240, 16};

By default, the program incorporates preconfigured conversion profiles for RGB565, RGB454, 8-bit and 4-bit grayscale, and monochrome color models.

However, it is possible to create any other conversion pattern using the wizard and program configuration options.

arduino-lcd-image-converter-options

As a tip, when exporting the image, you will normally want to modify the “Block Size” parameter that corresponds to the grouping of bytes in the export result, to adapt it to the needs of your graphic library.

Lcd image converter is Open Source and the code is available in the Github repository. The project page (http://www.riuson.com/lcd-image-converter) is offline but the repository is still active, and it is possible to download it from Sourceforge.