Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0 for storing and accessing images?
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments. for storing and accessing images?

by gallaugher on Thu Jul 25, 2019 6:30 pm

Can receive, then serve full-screen bmp images that can be used for the PyPortal? I wrote an app to create multiple, related images that I hope to serve up on the PyPortal, and I want to use as the intermediary. A standard 320 x 240 .bmp file (the size of the PyPortal) is about 307KB when stored on my Mac, but the Adafruit learn for io feeds states:
"By default you can push values up to 1KB in length, but with feed history off, you can publish values up to 100KB in length."
This is from this adafruit learn page: ... ing-a-feed

307KB is the file of just the .bmp on my Mac desktop. When I convert it to data and enclose it in a simple json structure with two key/value pairs, one listing a String for the image file name, and another showing the raw data for the image, my Mac says this .json file is 1.5MB. For example, the created json is something like this:
{ "imageFileName" : \"Home\",
"imageData\" : "...raw bmp data follows inside the quotes...

If storing bmps isn't possible on, I see there are several PyPortal examples that pull jpegs from third party APIs (NASA image of the day, the CuteFuzz viewer). Any suggestions of services where I can post images directly from an iOS app, then serve them up as .jpegs? I've used Firebase Storage and this works, but it involves more configuration work that may be off-putting to novice users. I've tried reading shared file URLs for images stored on a public Google Drive, but can't seem to figure out how to get the PyPortal to use the URL to grab a file off the drive.

Here's a video of what I'm working on, running on a PyPortal:

The goal is to create an easy-to-configure solution so anyone can use the iOS App to create screens with text, images and buttons that would then be loaded on the PyPortal to be navigated through, like a touch-screen kiosk.

Everything works so far. The app allows users to layout screens with background images, text blocks, fonts, colors, etc., and can then create a 320x240 bmp for each page, along with any included navigation buttons.
The app also creates json that represents the "navigation tree" between all screens and has the touch area for the buttons on each screen.
I've also written a python program that runs on the PyPortal, reads this json, loads each screen (starting with a "home" screen), and sets button regions to respond to user presses and will navigate to the next screen.
The only thing I can't figure out yet is how to get the screen images created in iOS onto the PyPortal using the Internet (this'd allow a user to remotely update the Kiosk on the fly).
It'd also be useful to be able to save any images accessed by the PyPortal for later retrieval on the PyPortal. This way images could load super-fast locally after they've been accessed over the Internet for the first time.

If you want to try out the PyPortal portion, I've posted a public feed to my account that contains usable json.
I've also posted that you can load onto a PyPortal, along with five .bmps that can also be loaded to the home directory of the PyPortal for local navigation. Files are at: ... sp=sharing

If I can just figure out how to get the images onto the PyPortal using the Internet, this will open up a huge number of possibilities for PyPortal usage.

Thanks for any help / advice / comments. Cheers,

Posts: 166
Joined: Tue Aug 14, 2018 12:42 pm

Re: for storing and accessing images?

by gallaugher on Thu Jul 25, 2019 10:36 pm

I think wget will work. I've tried using the code below & it seems to access the .jpeg, convert it to a .bmp, and store it on my PyPortal.

image_url = ""
pyportal.wget(pyportal.image_converter_url(image_url,320, 240,color_depth=16),


I got a bit of help from the Discord Channel, that tipped me off to hunt for wget, then I uncovered the Thingaverse Viewer from a web search: ... r?view=all

Am hoping this solves the final step. Continued thanks to those who commented on earlier posts. I'll be sure to share what I finally implement.

Posts: 166
Joined: Tue Aug 14, 2018 12:42 pm

Re: for storing and accessing images?

by trackseven on Tue Aug 13, 2019 9:07 pm

Thank you for sharing your project and your code

Posts: 8
Joined: Mon Aug 12, 2019 4:21 pm

Please be positive and constructive with your questions and comments.