ImageGear for .NET
ImageGear Color Profile API

ImageGear for .NET offers two ways to specify color profiles to use for color conversion operations.

Both ways are easy to use, and you should use whichever one suits your particular application's needs.

To enable implicit or "automatic" usage of color profiles for color conversion operations, use the ImGearColorProfileManager Class object. The ImGearColorProfileManager Class and its methods allow enabling and disabling the automatic use of global color profiles for color space conversion and display operations. You will need to set its EnableProfiles Property to True, and specify global color profiles via its CmykProfile Property and/or RgbProfile Property. Once you have done this, these profiles will be used for the color space conversion. If a profile is associated with a particular image via ImGearRasterPage.ColorProfile Property, that profile will be used instead of a global profile as the source profile in a color space conversion. For example, the following code sets the global profiles and converts an image from CMYK to RGB:

C#
Copy Code
ImGearColorProfileManager.EnableProfiles = true;
using (FileStream fs = File.OpenRead("ig_cmyk_profile.icm"))
    ImGearColorProfileManager.CmykProfile = new ImGearColorProfile(fs);
using (FileStream fs = File.OpenRead("ig_rgb_profile.icm"))
    ImGearColorProfileManager.RgbProfile = new ImGearColorProfile(fs);
ImGearRasterProcessing.ConvertColorSpace((ImGearRasterPage)igPage,
    new ImGearColorSpace(ImGearColorSpaceIDs.RGB)); 

To use explicit specification of color profiles, call the method ImGearRasterProcessing.ConvertColorSpace Method or overload it. The conversion operation will use the color profiles specified by the parameters, ignoring any settings of the ImGearColorProfileManager Class object. For example, the following code converts an image from CMYK to RGB by explicitly specifying color profiles: 

C#
Copy Code
ImGearColorProfile igColorProfileSource, igColorProfileDest;
using (FileStream fs = File.OpenRead("ig_cmyk_profile.icm"))
    igColorProfileSource = new ImGearColorProfile(fs);
using (FileStream fs = File.OpenRead("ig_rgb_profile.icm"))
    igColorProfileDest = new ImGearColorProfile(fs);
ImGearRasterProcessing.ConvertColorSpace((ImGearRasterPage)igPage,
    new ImGearColorSpace(ImGearColorSpaceIDs.RGB),
    igColorProfileSource, igColorProfileDest, ImGearRenderingIntents.PERCEPTUAL); 

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback