Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Pick_image: index of picked image?
-
Is there a way to get the index(es) of the picked image(s)?
Thanks by advance -
Not very efficient
# coding: utf-8 import photos def get_index(filename): c = photos.get_count() for i in range(c): m = photos.get_metadata(i) if m.get('filename') == filename: return i img = photos.pick_image(show_albums=True, include_metadata=True, original=True, raw_data=False, multi=False) filename = img[1].get('filename') i = get_index(filename) print filename + ' = ' + str(i)
-
Thanks for helping, but I've checked and it's possible to have photos with the same file name, thus ...
-
sounds like you'd need to first find all possible matches, then compare binary data...
-
Yes, I could but this is only a first draft to show to beginners how to delete selected photos, what Pythonsa does not offer in the photos module (I'm busy to replace all my workflows by Pythonista scripts and Workflows w has this action).
Normally, if no file name is double, I don't need to get whole data, except if you want to display the images for confirmation of which have been selected.
Hoping I'm clear in my poor Englsh, and thanks to read me 😊