OnDiskBitmap – Loads pixels straight from disk

Loads values straight from disk. This minimizes memory use but can lead to much slower pixel load times. These load times may result in frame tearing where only part of the image is visible.

It’s easiest to use on a board with a built in display such as the Hallowing M0 Express.

import board
import displayio
import time
import pulseio

board.DISPLAY.auto_brightness = False
board.DISPLAY.brightness = 0
splash = displayio.Group()
board.DISPLAY.show(splash)

with open("/sample.bmp", "rb") as f:
    odb = displayio.OnDiskBitmap(f)
    face = displayio.TileGrid(odb, pixel_shader=displayio.ColorConverter(), position=(0,0))
    splash.append(face)
    # Wait for the image to load.
    board.DISPLAY.wait_for_frame()

    # Fade up the backlight
    for i in range(100):
        board.DISPLAY.brightness = 0.01 * i
        time.sleep(0.05)

    # Wait forever
    while True:
        pass
class displayio.OnDiskBitmap(file)

Create an OnDiskBitmap object with the given file.

Parameters:file (file) – The open bitmap file
width

Width of the bitmap. (read only)

height

Height of the bitmap. (read only)