Gimp generates C arrays for OLED & LCD images

The attached Python script "file-cheader-save.py" is a plugin for the GIMP (www.gimp.org) which allows (small) grayscale images to be saved directly as a C header file containing an array of pixel data. Edit your grayscale image then select "Save As" and from GIMPs (long) list of formats pick "C Source code header", either 1 bit or 4 bit. Example output shown below, although it easily modified to suit your specific needs.

This forum won't allow .py files to be uploaded, so please remove the .txt extension I added to get around this.

This has been tested on Linux and Windows with the TI LM3S8962 EVK, see the Python source file for the install and use instructions.

Try out Inkscape, it's a nice vector graphics editor which can be used to make icons, export to GIMP, then to your OLED.

 

 

 

5 Replies

  • Hi

    You have not attached the "file-cheader-save.py" file,,can u plz attach the file or give some info , where to download that file .

    Thanks

  • Hi Penfold

    I am using BeagleBone AM335x ,and to test my display driver for 1024x768 resolution, i need an bmp to array converter tool . Can you guide me which tool i have to use to get an array from 1024x768 resolution image.

    I am completely blocked.

    Thanks

  • In reply to Satyaprakash Mishra:

    You probably need to be a lot more specific here because there are a million different image file formats. When you say "bmp", I presume you mean a Windows bitmap. If you are looking for something that will just dump this into a C array in its original format, the makefsfile tool included in the tools/bin directory of any TivaWare or StellarisWare release will do this for you (use the -f command line switch). If you need to convert the bitmap into a different format then dump that to a C array, you'll need something more like the script Satyaprakash provided here though, obviously, it would need to be modified to output the format you are looking for.

  • In reply to Satyaprakash Mishra:

    Satyaprakash Mishra

    I am completely blocked.

    Who isn't?

    And - might this "blocking" be of your own creation - and unlikely to be solved by originating poster's nearly 3 year past, post?

    Should that neat board/chip not have suitable forum - or other focused tech support link - you should find much, "content of interest" w/in the Stellaris Graphic Library - and multiple TFT-based Ap Kits...

    And beware - color images encoded via bmp simply "devour" memory.  A more complex jpg converter may warrant your/others investigation - especially if multiple images are in play ...

  • In reply to Dave Wilson:

    Thanks Mr Dave Wilson for ur quick response.

    I will try those necessary steps you mentioned above.

    Thanks