Class CsConverterUtil

java.lang.Object
com.itextpdf.pdfoptimizer.handlers.util.CsConverterUtil

public final class CsConverterUtil extends Object
Helper class which encapsulates util method for color space converting.
  • Method Details

    • convertBitmapImage

      public static BitmapImagePixels convertBitmapImage (BitmapImagePixels imagePixels, ColorConverter converter)
      Converts passed bitmap image bytes from one color space to another according to provided ColorConverter. 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 via ColorConverter.getSourceColorspace() matches the color space of the image (at least it has the same number of components as image does according to BitmapImagePixels.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 provided ColorDecoder.
      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 provided ColorConverter and ColorDecoder. 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 via ColorConverter.getSourceColorspace() matches the color space of the image (at least it has the same number of components as image does according to BitmapImagePixels.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