libraw unable to open dng file

Hi Team,

I have a DNG file and tried to decode it libraw without Adobe DNG SDK.

When I tried to open_buffer, load_raw was identified as lossy_dng_load_raw but then raw_count is zero so it returned -2.

Do I need to use Adobe DNG or is it expected to work just with libraw?

I have attached the image in this link, https://drive.google.com/file/d/18QaZiL_YBEXwrmKd9638zHuWpOo54V5y/view?u...

Thank you and best regards,
Fidel

Forums: 

The link you provided is not

The link you provided is not for everyone, but asks for 'request access permissions'.

Please change to public

-- Alex Tutubalin @LibRaw LLC

LibRaw 0.21 supports this

LibRaw 0.21 supports this file if built with -DUSE_JPEG -DUSE_JPEG8 and linked with libjpeg (or replacement) library

-- Alex Tutubalin @LibRaw LLC

Will it also decode the high

Will it also decode the high resolution raw image data? or just the internal embedded jpeg image?

Why ask things that you can

Why ask things that you can check yourself in a minute?

Yes, it will decode (so called) 'raw image data', but in this specific case it is not RAW, but processed 8-bit/3channel data with only 256 different values per channel.

Embedded JPEG previews are not decoded by LibRaw but provided as is (JPEG bytearray)

-- Alex Tutubalin @LibRaw LLC

I have tried to build libraw

I have tried to build libraw as you suggested with USE_JPEG and USE_JPEG8, I have also built it with and without USE_ZLIB just in case.

I was able to open_buffer but when I raw_unpack, it throws an exception on lossy_dng_load_raw -> jpeg_create_decompress. on this line,

uSize = SIZEOF(struct jpeg_decompress_struct);
if (structsize != uSize)
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
(int) SIZEOF(struct jpeg_decompress_struct), (int) structsize);

Not sure why I'm getting this error :(

Posting the solution here if

Posting the solution here if ever someone encounters the same issue,

apparently, in the VS project of LibRaw, you need to make the 'Struct Member Alignment' in the project properties the same with the generated library of libjpeg

having different settings results to unequal struct size between libjpeg and libraw (JERR_BAD_STRUCT_SIZE)