pyexiftool icon indicating copy to clipboard operation
pyexiftool copied to clipboard

Read from BytesIO image?

Open apiszcz opened this issue 3 years ago • 1 comments

Is it possible to retrieve exiftools metadata from a BytesIO object? I am trying the following, with error below.

img = Image.open('bus.jpg')
buf = io.BytesIO()
img.save(buf, 'jpeg')
imgbytes = buf.getvalue()
exif = exiftool.ExifTool.get_metadata(imgbytes)
pprint.pprint(exif)
 testexif.py
Traceback (most recent call last):
  File "C:\test\testexif.py", line 8, in <module>
    exif = exiftool.ExifTool.get_metadata(imgbytes)
TypeError: get_metadata() missing 1 required positional argument: 'filename'

apiszcz avatar Aug 14 '21 12:08 apiszcz

I don't think we can pipe data to exiftool because we're already using it for commands https://exiftool.org/forum/index.php?topic=3098.0

sylikc avatar Jan 30 '22 19:01 sylikc