ImageGear for C and C++ on Windows v19.5 - Updated
Reconstruct Camera Raw Images Using Custom Parameters
User Guide > How to Work with... > Formats with Additional Functionality > Digital Camera RAW > Reconstruct Camera Raw Images Using Custom Parameters

By default, ImageGear reconstructs Camera RAW images automatically, using the settings found in the image metadata. However, for some camera raw formats, ImageGear also allows you to use custom parameters for color reconstruction.

See Cameras Supported for DC RAW Formats for a list of cameras supported by ImageGear for DC RAW; the list includes information about the availability of custom color reconstruction. You can also verify whether custom color reconstruction is available for a specific image by calling IG_gui_dspl_adjraw_metadata_is_available.

The automatic color reconstruction process described below is also applicable to DNG images.

In order to apply custom color reconstruction to an image, you should first switch off all or some of the automatic color reconstruction operations. Use RECONSTRUCT_COLORS, APPLY_COLORSPACE_CONVERSION, and APPLY_TONE_CORRECTION control parameters of DCRAW, Headerless Digital Camera Raw, or DNG format filters for this.

If custom color reconstruction is not supported for an image (IG_gui_dspl_adjraw_metadata_is_available returns FALSE), an attempt to read it using non-default settings of RECONSTRUCT_COLORS, APPLY_COLORSPACE_CONVERSION, or APPLY_TONE_CORRECTION control parameters will result in an ImageGear error.

In order to perform the custom color reconstruction, you will need to obtain the color reconstruction metadata from the images. See Manipulating Image Data for information about how to access the metadata. See DCRAW Non-Image Data Structure for information on specific metadata tags used for color reconstruction.

Specific stages of color reconstruction are discussed below.

Color Space Conversion

In order to use a custom white balance for an image, set the "APPLY_COLORSPACE_CONVERSION" control parameter of DCRAW format filter to FALSE. Use the IG_IP_DCRaw_camera_to_sRGB_matrix_calculate function to calculate a conversion matrix, based on selected white balance and on known conversion matrices obtained from metadata. Use IG_colorspace_conversion_create_from_matrix and IG_colorspace_conversion_apply_to_image to convert the image to the linear sRGB color space.

Use the IG_color_temperature_initialize_from_preset function to create white balance settings from preset values; IG_color_temperature_initialize_from_XY and IG_color_temperature_convert_to_XY for converting between color temperature and white point XY values.

The APPLY_COLORSPACE_CONVERSION parameter only has effect if the RECONSTRUCT_COLORS parameter is TRUE.

Tone Correction

In order to adjust image tone (contrast/brightness curve), set the "APPLY_TONE_CORRECTION" filter option to FALSE. This will tell ImageGear to skip the tone correction step. The application can create a Tone correction LUT using IG_IP_DCRaw_tone_LUT_build, or build its own Tone LUT. In order to convert the image to the standard sRGB color space, an additional sRGB Gamma LUT must be applied. Use IG_IP_DCRaw_RGB_gamma_LUT_build to build sRGB Gamma LUT.

Use IG_IP_transform_with_LUTs to apply a LUT to the image.

The APPLY_TONE_CORRECTION parameter only has effect if both APPLY_COLORSPACE_CONVERSION and RECONSTRUCT_COLORS options are TRUE.