Inkplate drawImage() method with converted bitmap file

Customer:

I found this function in the documentation:

bool drawImage(const char *path, const Format &format, const int x, const int y, const bool dither = 1, const bool invert = 0);

I tried to use it like this:

display.drawImage("rbt_mic_logo.h", bmp, 873, 22, true, true);

The file rbt_mic_logo.h contains a bitmap from the image converter and is in the same directory that I upload to the display. However, I get this error: 'bmp' was not declared in this scope (with suggested alternative: 'bcmp').

How do I correctly draw this bitmap on the display?

Originally submitted via email support on 6 September 2023. Migrated to the forum for community visibility.

Soldered Support:

You need to include the file in the sketch first. See this example for drawing an image from RAM that was converted in the image converter:

As shown in the example, the file has to be included in the sketch and then you can call:

display.drawImage(picture2, 0, 0, 212, 104); // Display selected picture at location X=0, Y=0, width 212, height 104

The width and height must match the actual image dimensions. Also, make sure you’re converting the image in 1bit mode or 3bit mode according to your sketch - these produce different files.