Forum Archive

Reading EXIF data from photo

bee18

Hi,

I plan to write a simple app that puts a datetime stamp to a photo based on its EXIF data. So far I haven't found a way to read the EXIF data, especially using Pythonista. Can anybody give me a light on this? Thank you.

-Bee

Dann239

Check out the Photos module in the Pythonista documents. More specifically, photos.get_metadata.

JonB

You can use the included in PIL module:

http://stackoverflow.com/questions/4764932/in-python-how-do-i-read-the-exif-data-for-an-image

Note that _getexif() attribute might not exist if you opened a gif or png. Threw me off when I first tried this, since apparently screenshots in ios are taken as png, but named jpg, and that's what I had lying around in my pythonista folder.

bee18

If the photo doesn't have exif data, can I take the data from the file info e.g. datetime of file creation? Is there any python function to read it? Not the datetime of last file modification but the true file creation.

Thank you.

dgelessus

Theoretically you could use the os module's stat() function to check the creation date, though I don't know if it is accurate with photos imported from the camera roll.

ccc

Code from your filenav would make it easy to do some experiments.

techteej

Did you look at this yet?

bee18

Thank you for providing link to other projects. filenav seems pretty cool. I'll start with that. :)