mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16: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
|
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():
|
def test_write_exif_metadata():
|
||||||
file_path = "Tests/images/flower.jpg"
|
file_path = "Tests/images/flower.jpg"
|
||||||
test_buffer = BytesIO()
|
test_buffer = BytesIO()
|
||||||
|
|
|
@ -3289,7 +3289,9 @@ class Exif(MutableMapping):
|
||||||
if not data:
|
if not data:
|
||||||
return
|
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)
|
self.head = self.fp.read(8)
|
||||||
# process dictionary
|
# process dictionary
|
||||||
from . import TiffImagePlugin
|
from . import TiffImagePlugin
|
||||||
|
|
Loading…
Reference in New Issue
Block a user