Add new comment

Thank you very much for your

Thank you very much for your help! I feel like I am close, but I am still getting an exception at
write_JPEG_file(outfn, 10);

This is the same function as in libjpeg-turbo example. (https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/example.txt)

Do you see any glaring errors? Thanks a lot in advance!

int main(int ac, char* av[])
{
int ret;
char outfn[1024];

LibRaw RawProcessor;

_putenv((char*)"TZ=UTC"); // dcraw compatibility, affects TIFF datestamp field

#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params

OUT.output_bps = 8;

if ((ret = RawProcessor.open_file(av[1])) != LIBRAW_SUCCESS)
return 1;

if ((ret = RawProcessor.unpack()) != LIBRAW_SUCCESS)
return 1;

ret = RawProcessor.dcraw_process();
if (LIBRAW_SUCCESS != ret)
if (LIBRAW_FATAL_ERROR(ret))
return 1;

libraw_processed_image_t* image = RawProcessor.dcraw_make_mem_image(&ret);
if (LIBRAW_SUCCESS != ret)
if (LIBRAW_FATAL_ERROR(ret))
return 1;

_snprintf_s(outfn, sizeof(outfn), "%s.jpeg", av[1]);

image_height = image->height;
image_width = image->width;
image_buffer = (JSAMPLE*)image->data;
write_JPEG_file(outfn, 10);

LibRaw::dcraw_clear_mem(image);
RawProcessor.recycle(); // just for show this call

return 0;
}

baris