Use of my own pictures/images
Just got started with pythonista and I have succeeded in writing a script that presents an image from the examples found in pythonista, but instead I want to use one of my own pictures but fails to import it into pythonista. Have saved an image from photos to the folder app on the iPad but the image file is grayed out when I try to open it as an external file from pythonista.
Have also tried to share the image directly from photos, selecting the option ”run pythonista script" but gets no option to import any file so I do not understand how to do.
Can someone please help me move forward?
a néxt script is for move a copy.
from PIL import Image import appex import ui def main(): if not appex.is_running_extension(): print('This script is intended to be/ run from the sharing extension.') return img = appex.get_image() path=appex.get_file_path() if not img: print('No input image') return if not img.mode.startswith('RGB'): img = img.convert('RGB') #print(path) use to know if the image has a direccion, do not #print(img) #print(str(img.format).lower()) is format, in case a .PNG appears #b=img.tobytes() a try img.save('hulk.'+str(img.format).lower()) # is sace in join to the script img.show() # just to simplified if __name__ == '__main__': main()
next u can upload the file to Google and remove it
import photos pil_image = photos.pick_asset(assets=photos.get_assets()).get_image()
And, if you really want a copy, in the Pythonista files browser:
- bottom left, + button
- photo library
Thank you so much for your help ... now I have managed to move on