Add new comment

using example, image data not understood

Reading a CR2 canon file from a Canon 6D MK1, known good. Using the example code on the "https://www.libraw.org/docs/API-overview.html" page; the max value out of any RGBG sample is about 5600. Scaling the data up ((data/5600.0)*65535) to a full 16bit sample results in what looks like fairly even tempered noise, not anything like the image data that is actually in the file.

I want to read out the RGB values of the image, and this doesn't seem to do that:

iProcessor.open_file(
iProcessor.unpack(
iProcessor.raw2image(

Followed by a loop reading the data, as follows, where v step through the image size as shown in the example:

iProcessor.imgdata.image[v][0];
iProcessor.imgdata.image[v][1];
iProcessor.imgdata.image[v][2];
iProcessor.imgdata.image[v][3];

The image dimensions are right, and I am not getting any errors (API call results are 0.)

It is presently unclear to me just what I am supposed to do, other than the example, to read back valid 16 bit/channel RGB image data.

Forums: