Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't figure out the syntax to display to the display a .jpg via Pillow, its not clear in the backlight example #12

Open
snarflakes opened this issue Apr 6, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@snarflakes
Copy link

snarflakes commented Apr 6, 2022

I would super appreciate the python syntax for displaying a .jpg using Pillow. Perhaps in the backlight example? Something super brief would be awesome. The old ST module used: disp.image(X).

thanks again,
beautiful screen.

Snarflakes

@Gadgetoid Gadgetoid added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 6, 2022
@jftsang
Copy link

jftsang commented Mar 27, 2023

Hi @snarflakes, try something like this:

width = DisplayHATMini.WIDTH
height = DisplayHATMini.HEIGHT
buffer = Image.new("RGB", (width, height))
displayhatmini = DisplayHATMini(buffer, backlight_pwm=True)

with Image.open("myFile.jpg") as im:
    buffer.paste(
        im.resize((width // 2, height // 2)), 
        (width // 4, height // 4)
    )

displayhatmini.display()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants