- 
                Notifications
    You must be signed in to change notification settings 
- Fork 76
Description
I was using rawpy to read 16-bit DNG images and unfortunately I found the image size returned was wrong.
To reproduce the issue, let's look at this image https://data.csail.mit.edu/graphics/fivek/img/dng/a0001-jmac_DSC1459.dng
This is a 16-bit DNG image taken by Nikon D70 back in 2004. Either download it and check EXIF locally or check it online gives the resolution to be 3008x2004 (or 2004x3008, this is not the issue).
However, if I read the image with the code snippet below. It will return Numpy tensor size of (3, 2014, 3040), which does not match the above. And surely 3008x2004 is correct.
import rawpy
def read_dng_image(path, bitspersample=16):
  with rawpy.imread(path) as raw:
    np_img = raw.postprocess(output_bps=bitspersample)
    np_img= np_img.transpose(2, 0, 1) # (H, W, C) to (C, H, W)
  return np_img
img = read_dng_image('a0001-jmac_DSC1459.dng')
print(img.shape)I'm running on Ubuntu 16.04 with python 3.8.3
Any idea about the cause?
What wroth to mention is that if I open such DNG image with Ubuntu's photo editor - shotwell, it also gives the wrong image size. Could it be the because both rawpy and shotwell share the same low level library that resulted in the same wrong value?