-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
Description
What did you do?
I opened the images using Pillow and printed their detected size.
What did you expect to happen?
The size to be reported correctly. This causes conversions to JPEG to be way too small.
What actually happened?
Size was reported incorrectly.
What are your OS, Python and Pillow versions?
- OS: EndeavourOS
- Python: 3.10
- Pillow: 9.2.0 (Also tested -git as of 05/08/22)
>>> from PIL import Image
>>> img = Image.open("sample.dng")
>>> img.width, img.height
(256, 195)
>>> img = Image.open("sample2.NEF")
>>> img.width, img.height
(160, 120)Interestingly the file command also shows the wrong sizes:
$ file sample.dng
sample.dng: TIFF image data, little-endian, direntries=60, height=195, bps=734, compression=none, PhotometricIntepretation=RGB, manufacturer=NIKON CORPORATION, model=NIKON Z 7, orientation=upper-right, width=256
$ file sample2.NEF
sample2.NEF: TIFF image data, little-endian, direntries=28, height=120, bps=352, compression=none, PhotometricIntepretation=RGB, manufacturer=NIKON CORPORATION, model=NIKON D7200, orientation=upper-left, width=160
While inspecting the files with Dolphin shows the correct sizes:

qomhmd