Convert xbm (or byte array) to format used by GLCD_ST7565::drawBitmap

Hi I am trying to draw an icon to the emonGLCD display using the GLCD_ST7565::drawBitmap function in the glcdlib. I have this icon in an .xbm format currently as you can open it in an editor and copy the byte array etc. However this does not produce the desired result. I am guessing this is because of indexing or encoding differences. Does anyone know an easy way to create an input to the function from an icon file of a given size?

Think I may have found the answer on the old forums:

https://openenergymonitor.org/emon/node/3957

1 Like

Sorry, I’ve never experimented drawing bitmaps on the GLCD.

1 Like

Just to be clear, in the end I used the Bitmap Converter/LCD Assisstant available here: Bitmap converter for mono and color LCD displays . The attached screenshot shows the settings that worked for the prepared bitmap. The process I followed was:

  1. Scale/draw base image in GIMP of correct pixel dimensions.
  2. Export as bitmap file.
  3. Open ‘Bitmap Converter’ and load bitmap file. Use the settings as in the following screenshot:
  4. File->Save to a text file the output.
  5. Open that file and copy the byte array.

It would probably be relatively easy to create Python script to take in bitmap file and spit out the byte array.

2 Likes