Your photo is fake! When in doubt, most photos taken with a smartphone should have Exif data. Analyze photos with suspicious time series on Twitter etc. I think it can be used in various ways.
pilexif.py
#!/user/bin/env python
# -*- coding: utf-8 -*-
import sys
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif(file,field):
img = Image.open(file)
exif = img._getexif()
exif_data = []
for id, value in exif.items():
if TAGS.get(id) == field:
tag = TAGS.get(id, id),value
exif_data.extend(tag)
return exif_data
my_img = "sample.jpg "
print get_exif(my_img,"DateTimeOriginal")
Only specific data can be picked up by rewriting the part passed in the last print.
print get_exif(my_img,"DataTime")
print get_exif(my_img,"Model")
etc.
Recommended Posts