mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 00:46:16 +03:00
Corrected reading EXIF metadata without prefix
This commit is contained in:
parent
9df95e77c5
commit
0cc2e696cb
|
@ -30,6 +30,15 @@ def test_read_exif_metadata():
|
|||
assert exif_data == expected_exif
|
||||
|
||||
|
||||
def test_read_exif_metadata_without_prefix():
|
||||
with Image.open("Tests/images/flower2.webp") as im:
|
||||
# Assert prefix is not present
|
||||
assert im.info["exif"][:6] != b"Exif\x00\x00"
|
||||
|
||||
exif = im.getexif()
|
||||
assert exif[305] == "Adobe Photoshop CS6 (Macintosh)"
|
||||
|
||||
|
||||
def test_write_exif_metadata():
|
||||
file_path = "Tests/images/flower.jpg"
|
||||
test_buffer = BytesIO()
|
||||
|
|
|
@ -3289,7 +3289,9 @@ class Exif(MutableMapping):
|
|||
if not data:
|
||||
return
|
||||
|
||||
self.fp = io.BytesIO(data[6:])
|
||||
if data.startswith(b"Exif\x00\x00"):
|
||||
data = data[6:]
|
||||
self.fp = io.BytesIO(data)
|
||||
self.head = self.fp.read(8)
|
||||
# process dictionary
|
||||
from . import TiffImagePlugin
|
||||
|
|
Loading…
Reference in New Issue
Block a user