Skip to content

Commit

Permalink
Can also read EXIF metadata from buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfischer-ch committed Feb 1, 2018
1 parent e2e7416 commit 8f521eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pytoolbox/multimedia/exif/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ class Metadata(object):

tag_class = tag.Tag

def __init__(self, path, orientation=None, gexiv2_version='0.10'):
def __init__(self, path=None, buf=None, orientation=None, gexiv2_version='0.10'):
import gi
gi.require_version('GExiv2', gexiv2_version)
from gi.repository import GExiv2
self.path = path
self.exiv2 = GExiv2.Metadata()
self.exiv2.open_path(path)
if buf:
self.exiv2.open_buf(buf)
elif path:
self.exiv2.open_path(path)
else:
raise ValueError('buf or file is required')
self.camera = camera.Camera(self)
self.image = image.Image(self, orientation)
self.lens = lens.Lens(self)
Expand Down

0 comments on commit 8f521eb

Please sign in to comment.