mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Test getting DPI from EXIF
This commit is contained in:
parent
8b649d6e79
commit
92acfca46f
BIN
Tests/images/photoshop-200dpi.jpg
Normal file
BIN
Tests/images/photoshop-200dpi.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
|
@ -167,14 +167,14 @@ class TestFileJpeg(PillowTestCase):
|
||||||
|
|
||||||
def test_progressive_large_buffer_highest_quality(self):
|
def test_progressive_large_buffer_highest_quality(self):
|
||||||
f = self.tempfile('temp.jpg')
|
f = self.tempfile('temp.jpg')
|
||||||
im = self.gen_random_image((255,255))
|
im = self.gen_random_image((255, 255))
|
||||||
# this requires more bytes than pixels in the image
|
# this requires more bytes than pixels in the image
|
||||||
im.save(f, format="JPEG", progressive=True, quality=100)
|
im.save(f, format="JPEG", progressive=True, quality=100)
|
||||||
|
|
||||||
def test_progressive_cmyk_buffer(self):
|
def test_progressive_cmyk_buffer(self):
|
||||||
# Issue 2272, quality 90 cmyk image is tripping the large buffer bug.
|
# Issue 2272, quality 90 cmyk image is tripping the large buffer bug.
|
||||||
f = BytesIO()
|
f = BytesIO()
|
||||||
im = self.gen_random_image((256,256), 'CMYK')
|
im = self.gen_random_image((256, 256), 'CMYK')
|
||||||
im.save(f, format='JPEG', progressive=True, quality=94)
|
im.save(f, format='JPEG', progressive=True, quality=94)
|
||||||
|
|
||||||
def test_large_exif(self):
|
def test_large_exif(self):
|
||||||
|
@ -500,6 +500,14 @@ class TestFileJpeg(PillowTestCase):
|
||||||
reloaded.load()
|
reloaded.load()
|
||||||
self.assertEqual(im.info['dpi'], reloaded.info['dpi'])
|
self.assertEqual(im.info['dpi'], reloaded.info['dpi'])
|
||||||
|
|
||||||
|
def test_dpi_from_exif(self):
|
||||||
|
# Arrange
|
||||||
|
# This Photoshop CC 2017 image has DPI in EXIF not metadata
|
||||||
|
im = Image.open("Tests/images/photoshop-200dpi.jpg")
|
||||||
|
|
||||||
|
# Act / Assert
|
||||||
|
self.assertEqual(im.info.get("dpi"), 200)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user