mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #499 from wiredfool/webp_exif
* Don't send None as exif to JpegImagePlugin._getexif -- homm * Test for fix -- wiredfool
This commit is contained in:
commit
2cc2a8cd62
|
@ -32,8 +32,10 @@ class WebPImageFile(ImageFile.ImageFile):
|
|||
def _open(self):
|
||||
data, width, height, self.mode, icc_profile, exif = _webp.WebPDecode(self.fp.read())
|
||||
|
||||
self.info["icc_profile"] = icc_profile
|
||||
self.info["exif"] = exif
|
||||
if icc_profile:
|
||||
self.info["icc_profile"] = icc_profile
|
||||
if exif:
|
||||
self.info["exif"] = exif
|
||||
|
||||
self.size = width, height
|
||||
self.fp = BytesIO(data)
|
||||
|
|
|
@ -82,3 +82,20 @@ def test_write_icc_metadata():
|
|||
assert_true(webp_icc_profile)
|
||||
if webp_icc_profile:
|
||||
assert_equal(webp_icc_profile, expected_icc_profile, "Webp ICC didn't match")
|
||||
|
||||
|
||||
def test_read_no_exif():
|
||||
file_path = "Tests/images/flower.jpg"
|
||||
image = Image.open(file_path)
|
||||
expected_exif = image.info['exif']
|
||||
|
||||
buffer = BytesIO()
|
||||
|
||||
image.save(buffer, "webp")
|
||||
|
||||
buffer.seek(0)
|
||||
webp_image = Image.open(buffer)
|
||||
|
||||
assert_false(webp_image._getexif())
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user