CircuitPython + displayio + SSD1531 - Multiple Images

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mven
 
Posts: 11
Joined: Tue Jun 21, 2022 12:02 am

CircuitPython + displayio + SSD1531 - Multiple Images

Post by mven »

I was following along with this tutorial - https://learn.adafruit.com/adafruit-1-5 ... thon-usage

All of the examples work fine and I can display text or the blinka image on my 1.5" OLED.

However I am trying to figure out how to display multiple images (PNGs currently) and text on the screen at the same time.

I can display individual PNGs and that works fine or I can display text but I have no clue how to display multiple PNGs+ text.

Is there a good reference or example somewhere I am maybe missing on how to do something like this?

Or will it not work with jpg/png images and I have to convert them to bitmaps and use displayio groups to accomplish this?

I am pretty new to CircuitPython and python in general so maybe I am just missing something super obvious.

Thanks in advance if anyone can point me in the right direction.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: CircuitPython + displayio + SSD1531 - Multiple Images

Post by adafruit_support_mike »

Are you using the display with a RasPi or a microcontroller?

A RasPi has enough RAM to decode images and generate bitmaps for display on a screen. In general, microcontrollers don't.

User avatar
mven
 
Posts: 11
Joined: Tue Jun 21, 2022 12:02 am

Re: CircuitPython + displayio + SSD1531 - Multiple Images

Post by mven »

Thanks for the response.

I am using a RasPi 4 model B 4GB.

I was reading up on PIL which I think is what I need to figure out to get it to work but got distracted by life and never quite figured it out last week.

I think I need to compose the images and text I want on the screen and then call draw image but the how of that thus far eludes me.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: CircuitPython + displayio + SSD1531 - Multiple Images

Post by adafruit_support_mike »

Most programing on the RasPi is done using Python, which has graphics tools and libraries you can use to build composite graphics. Many of our projects use PIL/pillow:

https://pillow.readthedocs.io/en/stable/

User avatar
mven
 
Posts: 11
Joined: Tue Jun 21, 2022 12:02 am

Re: CircuitPython + displayio + SSD1531 - Multiple Images

Post by mven »

I think I am probably complicating this more than it needs to be. My original goal was to load 3 separate PNGs, scale and position them on the screen, and then print text next to each image. However in hindsight it's probably better to combine the images into a single PNG in photoshop first then position that where I want it on the screen.

Placing the image seems easy enough using the sample code provided in the tutorial I linked in my first post. Going to try that and see if I can get the text to display properly beside it.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: CircuitPython + displayio + SSD1531 - Multiple Images

Post by adafruit_support_mike »

Don't even worry about making it a PNG.. that's a storage file format, and has to be decoded before you can send the data to a display.

In PIL and PILLOW, the object you'll use in code is an 'Image'. You can create a blank one of any size you want, then draw in it by placing other images, drawing text, and so on. That data will then go to the display.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”