ImageGear .NET v24.12 - Updated
ConvertColorSpace(ImGearRasterPage,ImGearColorSpace,ImGearPixel) Method




ImageGear24.Core Assembly > ImageGear.Processing Namespace > ImGearRasterProcessing Class > ConvertColorSpace Method : ConvertColorSpace(ImGearRasterPage,ImGearColorSpace,ImGearPixel) Method
Image to change color space.
New color space.
Background to composite the image over when removing alpha channel.
Converts page to a new color space, using the specified background color for images that contain Alpha channel.
Syntax
'Declaration
 
Public Overloads Shared Sub ConvertColorSpace( _
   ByVal page As ImGearRasterPage, _
   ByVal newColorSpace As ImGearColorSpace, _
   ByVal backgroundColor As ImGearPixel _
) 
'Usage
 
Dim page As ImGearRasterPage
Dim newColorSpace As ImGearColorSpace
Dim backgroundColor As ImGearPixel
 
ImGearRasterProcessing.ConvertColorSpace(page, newColorSpace, backgroundColor)
public static void ConvertColorSpace( 
   ImGearRasterPage page,
   ImGearColorSpace newColorSpace,
   ImGearPixel backgroundColor
)
public: static void ConvertColorSpace( 
   ImGearRasterPage* page,
   ImGearColorSpace newColorSpace,
   ImGearPixel* backgroundColor
) 
public:
static void ConvertColorSpace( 
   ImGearRasterPage^ page,
   ImGearColorSpace newColorSpace,
   ImGearPixel^ backgroundColor
) 

Parameters

page
Image to change color space.
newColorSpace
New color space.
backgroundColor
Background to composite the image over when removing alpha channel.
Remarks

If conversion removes the alpha channel from the image, the image is composited over a solid background specified by BackColor. Background should be in the same color space as the original image, but without the Alpha channel. For example, if the original image is in RGBA color space and newColorSpace is CMYK, background should have an RGB color space. The method will first transform the image into RGB and then to CMYK.

The following formula is used to burn alpha (i.e., to convert from RGBA/P to RGB):

If Page is not pre-multiplied:

I = I * A + B (1-A)

If Page is pre-multiplied:

I = I + B (1-A)

If the image contains extra channels, and newColorSpace contains extra channels, the method does not change them.

Note: Conversion to Grayscale colorspace takes into account human eye's sensitivity to different parts of the light spectrum. ImageGear uses the following formula when converting from RGB to Grayscale: Gray = Red * 77 / 255 + Green * 151 / 255 + Blue * 28 / 255. If you need to convert an image to Grayscale using equal weights for Red, Green and Blue, or any other weights, use ConvertColorSpace(ImGearRasterPage,ImGearColorSpace,Double[,])

See Also

Reference

ImGearRasterProcessing Class
ImGearRasterProcessing Members
Overload List
ImGearRasterPage Class
ImGearColorSpace Structure