Skip to main content

Inkplate 5V2 – Draw Image from Web

Drawing an image from the web on Inkplate 5V2 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 5V2:

Example Image
Example image by @alexisg on Wallpaper Safari
#include "Inkplate.h"            // Include the Inkplate library in the sketch
#include "WiFi.h" // Include the library for WiFi
Inkplate display(INKPLATE_3BIT); // Create an object for the Inkplate library and set it to 1-bit mode (BW)

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

void setup()
{
display.begin(); // Initialize the Inkplate library (you should call this function ONLY ONCE)
display.clearDisplay(); // Clear the display's frame buffer
display.display(); // Show a clear image on the display

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

// Connect to the WiFi network.
WiFi.mode(WIFI_MODE_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
display.print(".");
display.display();
}
display.println("\nWiFi OK! Downloading...");
display.display();
if (!display.drawImage("https://i.imgur.com/ssqBZP9.jpeg", 0, 0, false, false))
{
// If something fails (for example, a wrong filename or incorrect bitmap format), write an error message on the screen.
// REMEMBER! You can only use Windows Bitmap files 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()

Function draws an image from a 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.

Full Example

Inkplate5V2_Image_From_Web.ino

Connect to WiFi and draw an image from the web.