Class RawImageHelper

java.lang.Object
com.itextpdf.io.image.RawImageHelper

public final class RawImageHelper extends Object
Applies PDF image attributes to raw image data.
  • Constructor Details

    • RawImageHelper

      public RawImageHelper()
  • Method Details

    • updateImageAttributes

      public static void updateImageAttributes (RawImageData image, Map<String,Object> additional)
      Sets filters, decoding parameters, and attributes required to embed raw image data.
      Parameters:
      image - raw image to update
      additional - additional attributes to retain for non-CCITT images
      Throws:
      IllegalArgumentException - if image is not raw image data
    • updateRawImageParameters

      protected static void updateRawImageParameters (RawImageData image, int width, int height, int components, int bpc, byte[] data)
      Update original image with Raw Image parameters.
      Parameters:
      image - to update its parameters with Raw Image parameters.
      width - the exact width of the image
      height - the exact height of the image
      components - 1,3 or 4 for GrayScale, RGB and CMYK
      bpc - bits per component. Must be 1,2,4 or 8
      data - the image data
      Throws:
      IOException - on error
    • updateRawImageParameters

      protected static void updateRawImageParameters (RawImageData image, int width, int height, int components, int bpc, byte[] data, int[] transparency)
      Updates a raw image and optional component transparency ranges.

      Bilevel grayscale input is converted to CCITT Group 4 data.

      Parameters:
      image - image to mutate
      width - image width in pixels
      height - image height in pixels
      components - number of color components
      bpc - bits per component
      data - encoded sample bytes
      transparency - component-value pairs, or null
      Throws:
      IOException - if parameters or transparency ranges are invalid
    • updateRawImageParameters

      protected static void updateRawImageParameters (RawImageData image, int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency)
      Updates a CCITT-compressed raw image and optional transparency range.
      Parameters:
      image - image to mutate
      width - image width in pixels
      height - image height in pixels
      reverseBits - whether to reverse bits in data in place
      typeCCITT - CCITT compression type
      parameters - CCITT decoding parameters
      data - CCITT-compressed bytes to retain
      transparency - two-value transparency range, or null
      Throws:
      IOException - if the transparency range or compression type is invalid
    • updateCcittImageParameters

      protected static void updateCcittImageParameters (RawImageData image, int width, int height, boolean reverseBits, int typeCcitt, int parameters, byte[] data)
      Updates dimensions and CCITT parameters of a raw image.
      Parameters:
      image - image to mutate
      width - image width in pixels
      height - image height in pixels
      reverseBits - whether to reverse bits in data in place
      typeCcitt - CCITT compression type
      parameters - CCITT decoding parameters
      data - CCITT-compressed bytes to retain
      Throws:
      IOException - if typeCcitt is unsupported