Skip to main content

Inkplate 6COLOR – Draw Image from Web

Drawing an image from the web on Inkplate 6COLOR is simple using the draw function, which supports multiple image formats.

ℹ️
Supported formats: JPG, BMP, and PNG.
⚠️
JPG files without progressive encoding are supported.
ℹ️
If you experience issues displaying an image, try re-saving it with an image editing program. The issue is usually related to the image format.

Drawing an Image from a URL

Let's draw this image on Inkplate 6COLOR:

Example Image
Example image
#include "Inkplate.h"            // Include the Inkplate library in the sketch
#include "WiFi.h" // Include the WiFi library
Inkplate display; // Create an Inkplate object and set the library to 1-bit mode (BW)

const char ssid[] = ""; // Your WiFi SSID
const char *password = ""; // Your WiFi password

void setup()
{
Serial.begin(115200);
display.begin(); // Initialize the Inkplate library (you should call this function ONLY ONCE)
display.clearDisplay(); // Clear the display's frame buffer
display.display();

Serial.print("Connecting to WiFi...");

// Connect to the WiFi network.
WiFi.mode(WIFI_MODE_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("\nWiFi OK! Downloading...");
if (!display.drawImage("https://i.imgur.com/EjIOxx7.jpeg", 0, 0, false, false))
{
// If something fails (wrong filename or incorrect bitmap format), write an error message on the screen.
// REMEMBER! You can only use a Windows Bitmap file with a color depth of 1, 4, 8, or 24 bits with no compression!
display.println("Image open error");
display.display();
}
display.display();
WiFi.mode(WIFI_OFF);
}

void loop()
{
// Nothing...
}
Example Image
Example image

inkplate.drawImage()

This function draws an image from the specified char path.

Returns value: Returns true if the image was successfully drawn, otherwise false.

Function parameters:

TypeNameDescription
const char*pathPath and filename of the image. Can be a URL (for web images) or a file path (on the microSD card).
intxX-coordinate of the image's upper-left corner in the framebuffer.
intyY-coordinate of the image's upper-left corner in the framebuffer.
uint8_tditherDithering mode: 0 (disabled), 1 (enabled).
boolinvertIf true, inverts colors.