mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-29 17:33:08 +03:00
Merge pull request #4828 from radarhere/exif_text
This commit is contained in:
commit
fdc09206d0
BIN
Tests/images/exif_text.png
Normal file
BIN
Tests/images/exif_text.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 174 KiB |
|
@ -607,6 +607,11 @@ class TestFilePng:
|
||||||
exif = im.copy().getexif()
|
exif = im.copy().getexif()
|
||||||
assert exif[274] == 1
|
assert exif[274] == 1
|
||||||
|
|
||||||
|
# With a tEXt chunk
|
||||||
|
with Image.open("Tests/images/exif_text.png") as im:
|
||||||
|
exif = im._getexif()
|
||||||
|
assert exif[274] == 1
|
||||||
|
|
||||||
# With XMP tags
|
# With XMP tags
|
||||||
with Image.open("Tests/images/xmp_tags_orientation.png") as im:
|
with Image.open("Tests/images/xmp_tags_orientation.png") as im:
|
||||||
exif = im.getexif()
|
exif = im.getexif()
|
||||||
|
|
|
@ -514,10 +514,11 @@ class PngStream(ChunkStream):
|
||||||
v = b""
|
v = b""
|
||||||
if k:
|
if k:
|
||||||
k = k.decode("latin-1", "strict")
|
k = k.decode("latin-1", "strict")
|
||||||
v = v.decode("latin-1", "replace")
|
v_str = v.decode("latin-1", "replace")
|
||||||
|
|
||||||
self.im_info[k] = self.im_text[k] = v
|
self.im_info[k] = v if k == "exif" else v_str
|
||||||
self.check_text_memory(len(v))
|
self.im_text[k] = v_str
|
||||||
|
self.check_text_memory(len(v_str))
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user