Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exif reading library

Is there an exif library out there for Python 3.x? It seems every exif library I run into is for Python 2.x only. I don't need anything too fancy. Just reading the values is enough.

like image 247
System Down Avatar asked Dec 23 '12 06:12

System Down


1 Answers

Option 1. Use pyexiv2. See: pyexiv2 Bug #824440: Python 3 support You need boost-python for py3k and also to manually apply the patch posted at the end of the bug above, but aside from that it works. Probably easiest to get up and running under latest Ubuntu.

Option 2. Use PIL Downside: this branch/fork doesn't seem to be actively developed.

from PIL import Image
from PIL.ExifTags import TAGS

image = Image.open("test.jpg")
exif = image._getexif()
# decode exif using TAGS

Option 3. Use PythonMagick

from PythonMagick import Image

img = Image("image.jpg")
print img.attribute("EXIF:Orientation")

See also: Exif manipulation library for python

like image 200
Alex I Avatar answered Oct 01 '22 14:10

Alex I