Converting a RAW nef file to be written out as a PNG
Hi all,
I'm having trouble figuring out how to convert my RAW data from a Nikon D800 image into an RGB bitmap that I can use to create a PNG. I understand I will lose image quality and such, but I have my reasons for attempting to convert the image. Here's some code I've got:
if ((n_return = RawProcessor.open_file(l_input_file_name.c_str())) != LIBRAW_SUCCESS) { fprintf(stdout,"Cannot open_file\n"); b_bad_files = true; } // RawProcessor is the main class for libraw. // It is used here to unpack the file into data structures to be used later. if ((n_return = RawProcessor.unpack()) != LIBRAW_SUCCESS) { fprintf(stdout,"Cannot unpack file\n"); b_bad_files = true; } if (!b_bad_files) {// if !b_bad_files -- begin RawProcessor.adjust_sizes_info_only(); n_orientation = RawProcessor.imgdata.sizes.flip; // sets pointer to LibRaw internal structure of raw data: n_raw_input_vector = &RawProcessor.imgdata.rawdata.raw_image[0]; // set color max value: n_color_max_value = RawProcessor.imgdata.rawdata.color.maximum; // ...
Just a real simple opening and extracting of data. Does libraw offer any way to convert this 12-bit raw data, in a bayer pattern, into a 8-bit RGB bitmap? I tried using the dcraw functionality, but I got a weird looking image and I don't need to do any post processing per say, just conversion from 12-bit raw layout to an 8-bit RGB layout that I can use to write a PNG.
The only function I found was raw2image, maybe this would be of use for me? Thanks for any help!
Recent comments