Add images to iOS photos with Pythonista

I want to add images processed by Pythonista to iOS photos

Sample code

sample.py


import photos
import os
import tempfile
from PIL import Image

imageName = 'lena.png'
img = Image.open(imageName)
temp_path = os.path.join(tempfile.gettempdir(),imageName)
img.save(temp_path)
photos.create_image_asset(temp_path)

Commentary

The function to add an image is photos.create_image_asset (), but since the image must be saved somewhere, it feels like getting temp_path and saving it there once. is.

It's kind of smarter than saving it in the same directory where the script is.

Recommended Posts

Add images to iOS photos with Pythonista
Add Gaussian noise to images with python2.7
[IOS] GIF animation with Pythonista3. I was addicted to it.
Add fields to features with ArcPy
[IOS] Disassemble GIF animation with Pythonista3.
Learn to colorize monochrome images with Chainer
How to add a package with PyCharm
[IOS] Use a shared sheet with Pythonista3.
Upload images to Google Drive with Python
Get tweets with Google Cloud Function and automatically save images to Google Photos
Crop the image to rounded corners with pythonista
Convert PDFs to images in bulk with Python
Add rows to an empty array with numpy
I want to display multiple images with matplotlib.
Route guidance to iPhone photography location with Pythonista
One liner to make Lena images with scipy
How to display images continuously with matplotlib Note
Upload images to S3 with GUI using tkinter
Add / remove kernel to use jupyter with venv
Try to make client FTP fastest with Pythonista
How to process camera images with Teams or Zoom
Add information to the bottom of the figure with Matplotlib
Display Matsuya coupon (QR code) with Pythonista for iOS
Add convolution to MNIST
Convert 202003 to 2020-03 with pandas
The road to Pythonista
Center images with python-pptx
Is it possible to detect similar images only with ImageHash?
LGTM --Compose LGTM images with videos and photos and output GIF animation
Cloud Functions to resize images using OpenCV with Cloud Storage triggers
Add fake tilt shift effect to video with OpenCV + Python
Send experiment results (text and images) to slack with Python
Convert images to sepia toning with PIL (Python Imaging Library)
The usual way to add a Kernel with Jupyter Notebook
Save images on the web to Drive with Python (Colab)
[Memo to add] Page to see when developing with GAE / P
Send push notifications to iOS apps with Python2 (with sample code)