ImageEn, unit iexBitmaps

TIEICC

TIEICC

Declaration

TIEICC = class;

Description

TIEICC class contains a color profile. It is used for loading an image ICC profile and for displaying the ICC profile (which is sRGB by default).

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. This will modify the image. 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

// Apply color profile on rendering (image is not modified, it only renders with the color profile)
ImageEnView1.IEBitmap.ColorProfileMode := iecpRender;
ImageEnView1.IO.NativePixelFormat := True;  // This means "Do not convert to RGB"
ImageEnView1.IO.LoadFromFile('cmyk-jpeg.jpg');

// Apply color profile to the image (image colors are changed, i.e. image is modified)
ImageEnView1.IEBitmap.ColorProfileMode := iecpApply;
ImageEnView1.IO.NativePixelFormat := False; // This means "Convert to RGB"
ImageEnView1.IO.LoadFromFile('cmyk-jpeg.jpg');

// Do not apply color profile (image is not modified, and is rendered without the color profile)
ImageEnView1.IEBitmap.ColorProfileMode := iecpIgnore;
ImageEnView1.IO.NativePixelFormat := False; // This means "Convert to RGB"
ImageEnView1.IO.LoadFromFile('cmyk-jpeg.jpg');


// Load a color profile to apply to the image if one is not available
ImageEnView1.IO.Params.DefaultICCProfile.LoadFromFile('C:\Windows\System32\spool\drivers\color\AdobeRGB1998.icc');
ImageEnView1.IEBitmap.ColorProfileMode := iecpApply;
ImageEnView1.IO.LoadFromFile('C:\input.tif');


// Load a TIFF containing a CMYK profile, save to JPEG maintaining the profile
ImageEnView1.IEBitmap.ColorProfileMode := iecpIgnore;   // or iecpRender
ImageEnView.IO.LoadFromFile('D:\Img with ICC Profile.tif');
ImageEnView1.IO.Params.JPEG_ColorSpace := ioJPEG_CMYK;
ImageEnView1.IO.SaveToFile('D:\Img with ICC Profile.jpeg');


// Render image with a custom color profile
ImageEnView1.IEBitmap.ColorProfile.LoadFromFile( 'D:\ColorProfile.icc' );
ImageEnView1.IEBitmap.ColorProfileMode := iecpRender;
ImageEnView1.Update();


// 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

  


// Load the color profile of the current monitor
icc := TIEICC.Create();
icc.LoadFromFile( IEGlobalSettings().CurrentMonitorProfile );
// Do something with icc
icc.Free();


// Display the description of the ICC profile in the image
if ierICC in ImageEnView1.IO.Params.ContainsInfo() then
  ShowMessage( 'ICC Profile: ' + ImageEnView1.IO.Params.InputICCProfile.Description )
else
  ShowMessage( 'ICC Profile: None' );


// If the image has a valid color profile (for rendering) then display its information
if ImageEnView1.IEBitmap.ColorProfile.IsValid then
begin
  lblICCDescription     .Caption := 'Description:' + string( ImageEnView1.IEBitmap.ColorProfile.Description );
  lblICCCopyright       .Caption := 'Copyright:' + string( ImageEnView1.IEBitmap.ColorProfile.Copyright );
  lblICCInputColorSpace .Caption := 'Input Color Space:' + string( ImageEnView1.IEBitmap.ColorProfile.InputColorSpace );
  lblICCOutputColorSpace.Caption := 'Output Color Space:' + string( ImageEnView1.IEBitmap.ColorProfile.OutputColorSpace );
end;


// 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' );

Methods and Properties

Properties

Public Property  Copyright
Public Property  Description
Public Property  InputColorSpace
Public Property  OutputColorSpace
Public Property  IsApplied

Methods

Public Method  Apply
Public Method  Assign_AdobeRGB1998
Public Method  Assign_CMYKProfile
Public Method  Assign_LabProfile
Public Method  Assign_LabProfileD50
Public Method  Assign_LabProfileFromTemp
Public Method  Assign_sRGBProfile
Public Method  Assign_XYZProfile
Public Method  Assign
Public Method  CheckTransform
Public Method  Clear
Public Method  ConvertBitmap
Public Method  FreeTransform
Public Method  InitTransform
Public Method  IsValid
Public Method  LoadFromBuffer
Public Method  LoadFromFile
Public Method  LoadFromStream
Public Method  SaveToStream
Public Method  SaveToFile
Public Method  Transform

See Also

Color Management System
InputICCProfile
DefaultICCProfile
OutputICCProfile
ColorProfile
ColorProfileMode
CurrentMonitorProfile
TIEICC Supported Color Formats