python-pillow / python-pillow/Pillow
Raw formats (DNG, GPR, NEF)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.8k
- Forks
- 2.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 89
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:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the linked sample.dng and sample2.NEF files using Pillow's Image.open entry point, checking the reported width and height against the sizes shown by Dolphin. Trace how these raw formats are identified and their dimensions are read. Done means both files report their actual dimensions and JPEG conversions are no longer undersized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100