Add new comment

mismatch between size reported after libraw_open_file(), and decoded image size

Hello everyone, thank you for this nice thing.

I had a bug report for this image with libraw 0.21.4-2 (the version in ubuntu 25.10).

http://www.rawsamples.ch/raws/nikon/d1x/RAW_NIKON_D1X.NEF

The size reported by libraw_open_file() is:

(gdb) p raw->raw_processor ->sizes 
$4 = {raw_height = 1324, raw_width = 4028, height = 1324, width = 4024, 
  top_margin = 0, left_margin = 0, iheight = 1324, iwidth = 4024, 
  raw_pitch = 0, pixel_aspect = 0.5, flip = 0, mask = {{0, 0, 0, 0}, {0, 0, 0, 
      0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 
      0}, {0, 0, 0, 0}}, raw_aspect = 0, raw_inset_crops = {{cleft = 65535, 
      ctop = 65535, cwidth = 0, cheight = 0}, {cleft = 65535, ctop = 65535, 
      cwidth = 0, cheight = 0}}}

But after decoding, height is 2648.

`pixel_aspect` is 0.5 which perhaps means `iheight` needs to be doubled. Should libraw be applying this factor and has a bug here, or is it something I should do? The docs say:

 ushort iheight, iwidth;
    Size of the output image (may differ from height/width for cameras that require image rotation or have non-square pixels).

Forums: