Skip to main content

Inkplate 10 MicroPython - Draw Image from microSD card

Inkpalte 10 can load and render images directly from the onboard microSD card. This example shows how to initialize the SD card, list its contents and display a JPEG, PNG or BMP image on screen.


Displaying an image from the SD card

Before running this example, make sure your SD card is formatted as FAT16, FAT32 or exFAT and inserted into Inkplate 10. To learn how to format the microSD card click here

The picture used in the example can be downloaded directly from the Inkplate MicroPython Library.

from inkplate10 import Inkplate
import time
from os import listdir

inkplate = Inkplate(Inkplate.INKPLATE_2BIT)
inkplate.begin()
inkplate.initSDCard(fastBoot=True)
print(listdir("/sd"))

# Draw image onto the buffer
drawLength = time.ticks_ms()
inkplate.drawImage(
"sd/mountain.jpg",
0, 0,
invert=False,
dither=True,
kernel_type=Inkplate.KERNEL_FLOYD_STEINBERG
)
drawLength = time.ticks_ms() - drawLength
print("Time it took to draw to buffer: {} ms".format(drawLength))
inkplate.display()

# Put SD card interface to sleep
inkplate.SDCardSleep()
# To wake it again, use: inkplate.SDCardWake()

inkplate.drawImage()

Draw an image from a file path or URL into the display buffer.

Function parameters:

TypeNameDescription
StringpathPath to image (e.g. "sd/mountain.jpg") or URL.
Numberx0X coordinate of the top-left corner.
Numbery0Y coordinate of the top-left corner.
BooleaninvertIf True, invert image colors.
BooleanditherIf True, apply dithering for better grayscale rendering.
Constantkernel_typeDithering algorithm. Options: Inkplate.KERNEL_FLOYD_STEINBERG, Inkplate.KERNEL_JJN, Inkplate.KERNEL_STUCKI, Inkplate.KERNEL_BURKES.
ℹ️

Available options for dithering algorithm:

AlgorithmValue
Inkplate.KERNEL_FLOYD_STEINBERG0
Inkplate.KERNEL_JJN1
Inkplate.KERNEL_STUCKI2
Inkplate.KERNEL_BURKES 3

Performance Notes

  • JPG: ~3 seconds (or ~14s with dithering)
  • PNG: ~9 seconds (or ~19s with dithering)
  • BMP: ~20 seconds (or ~40s with dithering)
  • Maximum image file size: ~800kB
Inkplate 10 running the example code
Displaying an image from SD card.