This topic explains how to use color management features of Graphics Mill for .NET when displaying an image on the screen.
Usually, Graphics Mill for .NET displays an image with color management automatically. If an image has the embedded color profile (available through the ColorProfile property of the Bitmap class), BitmapViewer control or the Draw method will automatically apply color management. However, under some circumstances, color management is not applied. The reason may be one of the following:
Color management is disabled, the ColorManagementEngine property of the ColorManagementProvider returned by the Bitmap class instance is None.
In this case just set it to LittleCms or AdobeCmm to specify color management engine.
BitmapViewer1.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms 'or BitmapViewer1.Bitmap.ColorManagement.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms
BitmapViewer1.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms; //or BitmapViewer1.Bitmap.ColorManagement.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms;
Bitmap does not contain the embedded color profile. This can happen if the original file did not contain a profile at all or you are getting an image in a way other than loading it from file (for example using the Create method). In this case the profile should be assigned through the ColorProfile property:
BitmapViewer1.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms BitmapViewer1.Bitmap.Load("c:\mountain.jpg") If BitmapViewer1.Bitmap.ColorManagement.RgbColorProfile Is Nothing Then BitmapViewer1.Bitmap.ColorProfile = _ New Aurigma.GraphicsMill.ColorProfile("c:\sRGB Color Space Profile.icm") End If
BitmapViewer1.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms; BitmapViewer1.Bitmap.Load(@"c:\mountain.jpg"); if (BitmapViewer1.Bitmap.ColorManagement.RgbColorProfile == null) { BitmapViewer1.Bitmap.ColorProfile = new Aurigma.GraphicsMill.ColorProfile(@"c:\sRGB Color Space Profile.icm"); }
When preparing image for printing, it would be useful to be able to preview how it will actually look on the hardcopy. To achieve this, you should specify the profile of the target device using the TargetColorProfile property. Graphics Mill for .NET will apply the color management bearing both profiles in mind. This property usage is demonstrated in this code example:
BitmapViewer1.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms BitmapViewer1.Bitmap.Load("c:\Horses.jpg") BitmapViewer1.Bitmap.ColorManagement.RgbColorProfile = _ New Aurigma.GraphicsMill.ColorProfile("c:\sRGB Color Space Profile.icm") BitmapViewer1.Bitmap.ColorManagement.TargetColorProfile = _ New Aurigma.GraphicsMill.ColorProfile("c:\hpcljtps.icm") BitmapViewer1.Bitmap.ColorManagement.Convert(Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)
BitmapViewer1.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms; BitmapViewer1.Bitmap.Load(@"c:\Horses.jpg"); BitmapViewer1.Bitmap.ColorManagement.RgbColorProfile = new Aurigma.GraphicsMill.ColorProfile(@"c:\sRGB Color Space Profile.icm"); BitmapViewer1.Bitmap.ColorManagement.TargetColorProfile = new Aurigma.GraphicsMill.ColorProfile(@"c:\hpcljtps.icm"); BitmapViewer1.Bitmap.ColorManagement.Convert(Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);