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




page
Image to convert.
newColorSpace
New color space.
doNotScalePixels
Flag indicating whether to change pixel values according to the new color space.

Glossary Item Box

Converts page to a new color space, allowing to skip pixel data conversion.

Syntax

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

Parameters

page
Image to convert.
newColorSpace
New color space.
doNotScalePixels
Flag indicating whether to change pixel values according to the new color space.

Remarks

This method Converts page to the newColorSpace. This method works in two modes:

If dontScalePixels is false (default), the image's pixels are recalculated.

If the new color space differs from the old color space only by an alpha channel (add, remove, set to pre-multiplied/non-pre-multiplied), ChannelDepths of color channels are preserved. For example, 5-6-5-8 RGBA will be converted to 5-6-5 RGB. Otherwise, ChannelDepths of color channels are set to maximum of original channel depths. For example, 3-5-4 RGB will be converted to 5-5-5-5 CMYK.

Any conversions are supported, except for conversion into Indexed color space.

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.

If dontScalePixels is true, the page's color space property is changed, but the pixels are not modified. The number of channels of newColorSpace should be the same as that of the original image. When converting from Indexed to Grayscale, the palette is removed. When converting from Grayscale to Indexed, a default palette is created. Conversion to Grayscale colorspace takes into account the 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

©2013. Accusoft Corporation. All Rights Reserved.