Skip to main content

Images with the Image Converter

What this example shows​

Show a picture that is compiled into the sketch. The Soldered Image Converter turns an image into a C array in a header file, image.h, which the sketch includes and draws. The example folder already holds an image.h, so the sketch runs as it is.

To use your own picture:

  1. Open the Image Converter at tools.soldered.com/tools/image-converter.
  2. Upload your image and select Inkplate 7SPECTRA as the target board.
  3. Choose the color mode, and adjust dithering, resize and the other options as needed.
  4. Save the generated header file as image.h in the same folder as the sketch, replacing the one there.

Example code​

Select Board
Inkplate7SPECTRA_Image_Converter.ino
#include "Inkplate.h" // Include the Inkplate library
#include "image.h" // Include the image header generated by the Image Converter tool

Inkplate display; // Create an Inkplate object for Inkplate 7SPECTRA

void setup() {
display.begin(); // Initialize the display hardware
display.clearDisplay(); // Clear the frame buffer (does NOT clear the physical screen)

display.image.draw(image, 0, 0, image_w, image_h); // Arguments are: array variable name, start X, start Y, size X, size Y

display.display(); // Refresh the e-paper display to show the image
}

void loop() {
// No code needed here for this example
}

Functions used​

Inkplate()returns None

Creates the Inkplate object. Inkplate 7SPECTRA has a single six-color mode, so the constructor takes no mode argument.

ReturnsConstructor; no return value.

display.begin()returns void

Initializes the library, the peripherals and the frame buffer. Call it once in setup(); later calls are ignored.

ReturnsNothing.

display.clearDisplay()returns void

Fills the frame buffer with white. It does not change the panel.

ReturnsNothing.

display.image.draw(const uint8_t *buf, int x, int y, int16_t w, int16_t h, uint8_t c = 1, uint8_t bg = 0xFF)returns bool

Draws an image array from memory into the frame buffer, with its top-left corner at (x, y). image_w and image_h are defined in the generated image.h.

ReturnsWhether the image was drawn.

Parameters

TypeNameDescription
const uint8_t *bufThe image array, here image.
intx, yTop-left corner in pixels.
int16_tw, hImage width and height in pixels.
uint8_tcOptional. Defaults to 1.
uint8_tbgOptional. Defaults to 0xFF.
display.display(bool _leaveOn = 0)returns void

Sends the whole frame buffer to the panel and refreshes it.

ReturnsNothing.

What to expect​

The converted image appears on the screen, starting at the top-left corner. The sketch prints nothing to the Serial Monitor.

🔗Open the complete example

examples/Inkplate7SPECTRA/Basic/Inkplate7SPECTRA_Image_Converter

→