You'll use Apple Shortcuts to encode your image from the Photos app to send it to an Adafruit IO feed with the itsaSNAP app. You can download the Shortcut via the link below or build it out yourself using the steps below.
Select the Find Photos Where action to filter your photos by album, date, type, etc. For this example, I chose to focus on an album and then I randomized the photo choice by selecting Random under Sort by. You'll want to enable the Limit and make sure that Get 1 Photo is selected to send only one photo to Adafruit IO.
Next, the Convert Image action takes the Photo selected by the Find Photos Where action and converts it to a JPEG. You may need to experiment with the Quality slider. It should be set lower to stay within the size limits of an Adafruit IO feed. Make sure to turn off Preserve Metadata.
The Set variable action is used to create an instance of the Converted image called Jpeg. This lets you reference the Converted image more easily throughout the Shortcut; similar to using variables in your CircuitPython or Arduino code.
The Get Details of Images action is used to get the Width of the Jpeg. Set variable is used again to create a variable for the Width. The same actions are used to get the Height of the Jpeg.
This next part of the Shortcut is based on a Shortcut posted on the Shortcuts subreddit for discerning the orientation of an image. An If action checks if the Height is greater than the Width. If it is, then the image has a vertical/portrait orientation (3:4, 9:16, etc). Otherwise, it has a horizontal/landscape orientation (4:3, 16:9, etc). If the image is vertical, the Resize action changes the width to be 360 pixels. If the image is horizontal, the Resize action changes the height to be 360 pixels.
360 pixels is used so that the image will be small enough for an Adafruit IO feed and fill up the 720x720 display since the CircuitPython code is increasing the display group size by 2x.
The last portion of the Shortcut uses the Encode action to encode the result of the If statement, aka the resized image, with base64. Make sure that Line Breaks is set to None. Finally, the itsaSNAP Send Value action is used to send the result of the Base64 Encoded image to your feed.
Text editor powered by tinymce.