Class CsConverterUtil
java.lang.Object
com.itextpdf.pdfoptimizer.handlers.util.CsConverterUtil
Helper class which encapsulates util method for color space converting.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BitmapImagePixels
convertBitmapImage
(BitmapImagePixels imagePixels, ColorDecoder colorDecoder) Converts passed bitmap image bytes from one color to another according to providedColorDecoder
.static BitmapImagePixels
convertBitmapImage
(BitmapImagePixels imagePixels, ColorConverter converter) Converts passed bitmap image bytes from one color space to another according to providedColorConverter
.static BitmapImagePixels
convertBitmapImage
(BitmapImagePixels imagePixels, ColorConverter converter, ColorDecoder colorDecoder) Converts passed bitmap image bytes from one color space to another according to providedColorConverter
andColorDecoder
.static BitmapImagePixels
extractColorTableOfIndexedImage
(com.itextpdf.kernel.pdf.colorspace.PdfSpecialCs.Indexed indexedCs) Extracts color table from indexed color space instance.
-
Method Details
-
convertBitmapImage
public static BitmapImagePixels convertBitmapImage(BitmapImagePixels imagePixels, ColorConverter converter) Converts passed bitmap image bytes from one color space to another according to providedColorConverter
. It is expected that source color space of the converter matches the color space of the image. Otherwise, the result of the method invocation may be unpredictable.- Parameters:
-
imagePixels
- the bitmap image pixels to be converted -
converter
- the converter for the image. It is expected that its source color space which can be identified viaColorConverter.getSourceColorspace()
matches the color space of the image (at least it has the same number of components as image does according toBitmapImagePixels.getNumberOfComponents()
method. - Returns:
- image pixels converted according to converter
-
convertBitmapImage
public static BitmapImagePixels convertBitmapImage(BitmapImagePixels imagePixels, ColorDecoder colorDecoder) Converts passed bitmap image bytes from one color to another according to providedColorDecoder
.- Parameters:
-
imagePixels
- the bitmap image pixels to be converted -
colorDecoder
-ColorDecoder
- Returns:
- image pixels converted according colorDecoder
-
convertBitmapImage
public static BitmapImagePixels convertBitmapImage(BitmapImagePixels imagePixels, ColorConverter converter, ColorDecoder colorDecoder) Converts passed bitmap image bytes from one color space to another according to providedColorConverter
andColorDecoder
. It is expected that source color space of the converter matches the color space of the image. Otherwise, the result of the method invocation may be unpredictable.- Parameters:
-
imagePixels
- the bitmap image pixels to be converted -
converter
- the converter for the image. It is expected that its source color space which can be identified viaColorConverter.getSourceColorspace()
matches the color space of the image (at least it has the same number of components as image does according toBitmapImagePixels.getNumberOfComponents()
method. -
colorDecoder
-ColorDecoder
- Returns:
- image pixels converted according to converter and colorDecoder
-
extractColorTableOfIndexedImage
public static BitmapImagePixels extractColorTableOfIndexedImage(com.itextpdf.kernel.pdf.colorspace.PdfSpecialCs.Indexed indexedCs) Extracts color table from indexed color space instance.- Parameters:
-
indexedCs
- is an indexed color space instance - Returns:
-
color table as
BitmapImagePixels
or null if indexedCs is not valid indexed color space instance
-