mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
This commit is contained in:
parent
b1d0965c75
commit
7a8161162f
|
@ -119,8 +119,8 @@ def APP(self, marker):
|
||||||
|
|
||||||
# If DPI isn't in JPEG header, fetch from EXIF
|
# If DPI isn't in JPEG header, fetch from EXIF
|
||||||
if "dpi" not in self.info and "exif" in self.info:
|
if "dpi" not in self.info and "exif" in self.info:
|
||||||
exif = self._getexif()
|
|
||||||
try:
|
try:
|
||||||
|
exif = self._getexif()
|
||||||
resolution_unit = exif[0x0128]
|
resolution_unit = exif[0x0128]
|
||||||
x_resolution = exif[0x011A]
|
x_resolution = exif[0x011A]
|
||||||
try:
|
try:
|
||||||
|
@ -131,7 +131,9 @@ def APP(self, marker):
|
||||||
# 1 dpcm = 2.54 dpi
|
# 1 dpcm = 2.54 dpi
|
||||||
dpi *= 2.54
|
dpi *= 2.54
|
||||||
self.info["dpi"] = dpi, dpi
|
self.info["dpi"] = dpi, dpi
|
||||||
except KeyError:
|
except (KeyError, SyntaxError):
|
||||||
|
# SyntaxError for invalid/unreadable exif
|
||||||
|
# KeyError for dpi not included
|
||||||
self.info["dpi"] = 72, 72
|
self.info["dpi"] = 72, 72
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user