ImageGear .NET - Updated
ConvertColorSpace(ImGearRasterPage,ImGearColorSpace,ImGearColorProfile,ImGearColorProfile,ImGearRenderingIntents) Method
Example 




ImageGear24.Core Assembly > ImageGear.Processing Namespace > ImGearRasterProcessing Class > ConvertColorSpace Method : ConvertColorSpace(ImGearRasterPage,ImGearColorSpace,ImGearColorProfile,ImGearColorProfile,ImGearRenderingIntents) Method
Image to change color space.
New color space.
Initial color space profile.
The new color space profile.
Rendering intent.
Converts page to a new color space using the specified color profiles and rendering intent.
Syntax
'Declaration
 
Public Overloads Shared Sub ConvertColorSpace( _
   ByVal page As ImGearRasterPage, _
   ByVal newColorSpace As ImGearColorSpace, _
   ByVal sourceProfile As ImGearColorProfile, _
   ByVal destinationProfile As ImGearColorProfile, _
   ByVal renderingIntent As ImGearRenderingIntents _
) 
'Usage
 
Dim page As ImGearRasterPage
Dim newColorSpace As ImGearColorSpace
Dim sourceProfile As ImGearColorProfile
Dim destinationProfile As ImGearColorProfile
Dim renderingIntent As ImGearRenderingIntents
 
ImGearRasterProcessing.ConvertColorSpace(page, newColorSpace, sourceProfile, destinationProfile, renderingIntent)

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

Reference

ImGearRasterProcessing Class
ImGearRasterProcessing Members
Overload List
ImGearRasterPage Class
ImGearColorSpace Structure
ImGearColorProfile Class
ImGearRenderingIntents Enumeration