ImageGear for .NET
ConvertColorSpace(ImGearRasterPage,ImGearColorSpace,ImGearColorProfile,ImGearColorProfile,ImGearRenderingIntents) Method
See Also  Example Send Feedback
ImageGear21.Core Assembly > ImageGear.Processing Namespace > ImGearRasterProcessing Class > ConvertColorSpace Method : ConvertColorSpace(ImGearRasterPage,ImGearColorSpace,ImGearColorProfile,ImGearColorProfile,ImGearRenderingIntents) Method




page
Image to change color space.
newColorSpace
New color space.
sourceProfile
Initial color space profile.
destinationProfile
The new color space profile.
renderingIntent
Rendering intent.

Glossary Item Box

Converts page to a new color space using the specified color profiles and rendering intent.

Syntax

 
Visual Basic
C#
Managed Extensions for C++
C++/CLI
 
 

Parameters

page
Image to change color space.
newColorSpace
New color space.
sourceProfile
Initial color space profile.
destinationProfile
The new color space profile.
renderingIntent
Rendering intent.

Remarks

The image's pixel data is modified to conform to the new color space. This method does not concern itself with any of the settings of ImageGear.Core.ImGearColorProfileManager class. Instead, it allows immediate and explicit specification of color profiles to use for the conversion.

Example

C#Copy Code
// Load color profiles and convert an image from CMYK into RGB color space.

// Get the base path for the running executable.
string exePath = Assembly.GetExecutingAssembly().Location;
Int32 nIndex = exePath.LastIndexOf("\\");
exePath = exePath.Remove(nIndex + 1, exePath.Length - nIndex - 1);
// Read color profiles from the executable's path.
using (FileStream fs = File.OpenRead(exePath + "ig_cmyk_profile.icm"))
    ImGearColorProfileManager.CmykProfile = new ImGearColorProfile(fs);
using (FileStream fs = File.OpenRead(exePath + "ig_rgb_profile.icm"))
    ImGearColorProfileManager.RgbProfile = new ImGearColorProfile(fs);
// Convert an opened CMYK image into the RGB colorspace using ImageGear color profiles.
ImGearRasterProcessing.ConvertColorSpace(igRasterPage,
    new ImGearColorSpace(ImGearColorSpaceIDs.RGB), ImGearColorProfileManager.CmykProfile,
    ImGearColorProfileManager.RgbProfile, ImGearRenderingIntents.PERCEPTUAL);
Visual BasicCopy Code
' Load color profiles and convert an image from CMYK into RGB color space.

' Get the base path for the running executable.
Dim exePath As String = Assembly.GetExecutingAssembly().Location
Dim nIndex As Int32 = exePath.LastIndexOf("\")
exePath = exePath.Remove(nIndex + 1, exePath.Length - nIndex - 1)
' Read color profiles from the executable's path.
Using fs As FileStream = File.OpenRead(exePath + "ig_cmyk_profile.icm")
    ImGearColorProfileManager.CmykProfile = New ImGearColorProfile(fs)
End Using
Using fs As FileStream = File.OpenRead(exePath + "ig_rgb_profile.icm")
    ImGearColorProfileManager.RgbProfile = New ImGearColorProfile(fs)
End Using
' Convert an opened CMYK image into the RGB colorspace using ImageGear color profiles.
ImGearRasterProcessing.ConvertColorSpace(igRasterPage, New ImGearColorSpace(ImGearColorSpaceIDs.RGB), _
 ImGearColorProfileManager.CmykProfile, ImGearColorProfileManager.RgbProfile, ImGearRenderingIntents.PERCEPTUAL)

See Also

©2013. Accusoft Corporation. All Rights Reserved.