Add new comment

And second followup (several

And second followup (several notes):

'real picture' is more complex than single raw_image array.
For non-bayer images, raw_image is NULL after unpack(), but color3_image or color4_image is not null (color4 image's 4'th component usually zero, but for 4-shot files from Leaf or Pentax it is not zero).

For floating point (DNGs) float_image, float3_image, float4_image pointers are not zero (bayer, 3-component, 4-component data).

Please note, that row pitch may be greater than raw_with*(element size). real pitch is stored in imgdata.rawdata.sizes.raw_pitch and it is always in bytes (divide by 2 for raw_image to get items, divide by 16 for float4_image, etc).

Also, rawdata.*image arrays contains 'black frame' pixels, so use rawdata.sizes: raw_width/height, top_/left_margin and width/height to access image part containing real image data.

the raw2image() call handles all specifics, so look into source for details :)

-- Alex Tutubalin @LibRaw LLC