ImageEn, unit iexBitmaps

TIOParams.InputICCProfile

TIOParams.InputICCProfile

Declaration

property InputICCProfile: TIEICC;

Description

Provides access to the ICC profile stored with the current image (e.g. by a digital camera or scanner)..
If ColorProfileMode = iecpApply, a transformation from InputICCProfile to OutputICCProfile is performed when loading the image (modifying the image).
If ColorProfileMode = iecpRender, InputICCProfile is copied to ColorProfile and used to render the image (without modifying the image).

InputICCProfile is also saved with the image if it hasn't been applied (JPEG, PSD and TIFF only).
If you are saving an image to a different format and want to maintain the ICC profile, ensure that the output color space matches the ICC format. For example, if a TIFF image contains a CMYK ICC profile, and you are saving to JPEG, you would need to change the JPEG_ColorSpace to ioJPEG_CMYK. The default color space (ioJPEG_YCBCR) would disable the ICC profile.

Understanding ICC Profiles

There are three main ImageEn ICC Profiles:

 InputICCProfile: The Color Profile of the Image

This is the profile contained in the image file (that was provided by the image source, e.g. a digital camera or scanner). It is filled when loading the image. ColorProfileMode specifies how it is used:
ColorProfileMode Effect
iecpApply Profile is applied to the image while loading (i.e the image is modified). To determine if an input profile has been applied, use: ImageEnView.IO.Params.InputICCProfile.IsApplied
iecpRender Profile is copied to ColorProfile and used to render the image (without modifying the image)
iecpIgnore Profile is stored but not used

If InputICCProfile has not been applied (i.e. ColorProfileMode is iecpRender or iecpIgnore), it is saved to the image when saving to a compatible format (JPEG, TIFF or PSD).

 DefaultICCProfile: The Fallback Color Profile

If an image does not contain a color profile (i.e. InputICCProfile), then this property allows you to specify an alternative profile to apply (ColorProfileMode = iecpApply) or render (ColorProfileMode = iecpRender) to the image.

 OutputICCProfile: The Output Color Profile

Defines the color profile for our usage of the image (e.g. a monitor or printer). This property defaults to sRGB, which is suitable for display, printing and saving.

Note:

TIEBitmap.ColorProfile is a copy of InputICCProfile that is used for rendering (i.e. when ColorProfileMode = iecpRender)
ICC profiles can be read from JPEG (RGB and CMYK), TIFF, PNG and PSD files (for PNG, only rendering is supported). They are written to JPEG, TIFF and PSD files
For the output profile (OutputICCProfile) ImageEn defaults to an embedded sRGB profile (suitable for display, printing and saving)

Demo

Demo  Demos\Display\ColorProfiles\ColorProfiles.dpr

Examples

// Save a JPEG with the ICC profile, sRGB2014.icc
ImageEnView1.IO.LoadFromFile( 'D:\201849018_A1.jpg' );
ImageEnView1.IO.Params.InputICCProfile.LoadFromFile('D:\sRGB2014.icc');
ImageEnView1.IO.SaveToFile( 'D:\Test_SRGB.jpg' );


// Apply InputICCProfile (VibranceMetallic_8400.icc) color profile to an image and output as OutputICCProfile (Defaults to sRGB)
// Note: This permanently changes the colors of the image
ImageEnView1.IO.LoadFromFile('C:\Wedding.jpg');
ImageEnView1.IO.Params.InputICCProfile.LoadFromFile('C:\VibranceMetallic_8400.icc');
ImageEnView1.IO.Params.InputICCProfile.ConvertBitmap( ImageEnView1.IEBitmap );
ImageEnView1.Update();  // Show changes to bitmap in viewer

  


// Save the color profile that is embedded in the image
if ierICC in ImageEnView1.IO.Params.ContainsInfo() then
  ImageEnView1.IO.Params.InputICCProfile.SaveToFile( ChangeFileExt( Filename, '.icc' ))
else
  ShowMessage( 'Image has no color profile' );

See Also

DefaultICCProfile
OutputICCProfile
Color Management System
ColorProfile
ColorProfileMode
ConvertColorFunction