mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Fix for file with DPI in EXIF but not metadata, and XResolution is an int rather than tuple
This commit is contained in:
parent
a4bfe1a1d5
commit
8b06fa9a21
|
@ -123,7 +123,10 @@ def APP(self, marker):
|
|||
try:
|
||||
resolution_unit = exif[0x0128]
|
||||
x_resolution = exif[0x011A]
|
||||
dpi = x_resolution[0] / x_resolution[1]
|
||||
try:
|
||||
dpi = x_resolution[0] / x_resolution[1]
|
||||
except TypeError:
|
||||
dpi = x_resolution
|
||||
if resolution_unit == 3: # cm
|
||||
# 1 dpcm = 2.54 dpi
|
||||
dpi *= 2.54
|
||||
|
|
Loading…
Reference in New Issue
Block a user