Using photos module
Hi to all!
I am new to pythonista and to Python as well. Looking at the latest pythonista version, I saw that there is a photo module. Hence, I was thinking about writing a small script to speed up my workflow: the idea would be to take a screenshot or photo (manually) and then launch a script that would:
- select the last photo in the camera roll (the screenshot)
- attach it to en email allowing me to choose the email address each time (I already know this is doable)
- delete the picture/screenshot from the camera roll.
Would it be possible?
omz last edited by
Certainly possible, except for one thing: You can't delete images from the camera roll. It's just not possible to do this for App Store apps, this is not a Pythonista-specific limitation.
Getting the last image from the camera roll is very simple:
img = photos.get_image()</pre>
For an example of how to send an email with an image attachment, using <code>smtplib</code>, have a look at this script:
For entering the email address, you could either use the <code>input_alert()</code> function in the <code>console</code> module, or just use Python's built-in <code>raw_input()</code> function.
Thanks for such a quick answer!
That's what I was afraid though...I will have to think about a workaround because I tend to take a lot of screenshots of things I don't want to keep but I just want to send into Evernote for instance, and I'd rather automate the delete part...
Oh, and another question: would it be possible to write a program that would allow to rectangle-select a part of the screen and then copy it to the clipboard?
It would also have to allow to open different apps or the latest app open before the script was launched...