-
-
Save Gadgetoid/0b8e352e377135d743338c9483178c01 to your computer and use it in GitHub Desktop.
Display a 4K jpeg from the microSD card
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import machine | |
import jpegdec | |
import sdcard | |
from picographics import PicoGraphics, DISPLAY_INKY_FRAME_7 as DISPLAY | |
# Initialise PicoGraphics | |
graphics = PicoGraphics(DISPLAY) | |
# Mount the SD card | |
sd_spi = machine.SPI(0, sck=machine.Pin(18, machine.Pin.OUT), mosi=machine.Pin(19, machine.Pin.OUT), miso=machine.Pin(16, machine.Pin.OUT)) | |
sd = sdcard.SDCard(sd_spi, machine.Pin(22)) | |
os.mount(sd, "/sd") | |
# Render the JPEG | |
jpeg = jpegdec.JPEG(graphics) | |
jpeg.open_file("/sd/placekitten-3840-2160.jpg") | |
jpeg.decode(dither=True, scale=jpegdec.JPEG_SCALE_QUARTER) | |
# Update the display | |
graphics.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment