Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get date and time when photo was taken from EXIF data using PIL

I can get the EXIF data from an image using PIL, but how can I get the date and time that the photo was taken?

like image 848
sashoalm Avatar asked Apr 14 '14 15:04

sashoalm


People also ask

How do I get the date from an image in Python?

Just calling ". getInfo()" on the ee. Date object will give you the number of milliseconds since 1970-01-01 in a Python dictionary.

Does EXIF data include date?

EXIF: Date Time Original (i.e. when the photo was taken)When you take a photo, your digital camera records the date and time information in the actual image as EXIF (Exchangeable Image File Format) metadata. This happens automatically when you point and click.

How do you find the date a digital photo was taken?

Distinguished. Right click on the thumbnail photo and select 'Properties' - the details of dates will be displayed. Some photos will have 'Meta Data' - this will provide more information about the photo. Some photos have 'Geo tags' - for location where taken.

Where do I find the EXIF data?

If you're using a Windows PC, right click the file and select 'Properties'. This will then display some of the EXIF data. If you're using a Mac, then right click and select 'Get Info'. These options won't show you all of the EXIF data though, but it'll show you the key bits such as settings used.


1 Answers

Found the answer eventually, the tag I needed was 36867:

from PIL import Image def get_date_taken(path):     return Image.open(path)._getexif()[36867] 
like image 200
sashoalm Avatar answered Oct 01 '22 06:10

sashoalm