ImageGear for Java
convertColorSpace(ImGearRasterPage,ImGearColorSpace,boolean) Method
Image to convert.
New color space.
Flag indicating whether to change pixel values according to the new color space.
Converts a page to new color space.

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,boolean)

com.accusoft.imagegear.core.ImGearRasterPagecom.accusoft.imagegear.core.ImGearColorSpace

Syntax
public static void convertColorSpace( 
   ImGearRasterPage page,
   ImGearColorSpace newColorSpace,
   boolean doNotScalePixels
)

Parameters

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

Reference

ImGearRasterProcessing Class
ImGearRasterProcessing Members
Overload List

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback