Class PDFImage.JpegDecoder

java.lang.Object
org.openpdf.renderer.PDFImage.JpegDecoder
Enclosing class:
PDFImage

private class PDFImage.JpegDecoder extends Object
Decodes jpeg data, possibly attempting a manual YCCK decode if requested. Users should use getColorModel() to see which color model should now be used after a successful decode.
  • Field Details

    • jpegData

      private final ByteBuffer jpegData
      The jpeg bytes
    • cm

      private ColorModel cm
      The color model employed
    • ycckcmykDecodeMode

      private boolean ycckcmykDecodeMode
      Whether the YCCK/CMYK decode work-around should be used
  • Constructor Details

    • JpegDecoder

      private JpegDecoder(ByteBuffer jpegData, ColorModel cm)
      Class constructor
      Parameters:
      jpegData - the JPEG data
      cm - the color model as presented in the PDF
  • Method Details

    • ycckcmykDecodeMode

      public void ycckcmykDecodeMode(boolean ycckcmykDecodeMode)
      Identify whether the decoder should operate in YCCK/CMYK decode mode, whereby the YCCK Chroma is specifically looked for and the color model is changed to support converting raw YCCK color values, working around a lack of YCCK/CMYK report in the standard Java jpeg readers. Non-YCCK images will not be decoded while in this mode.
      Parameters:
      ycckcmykDecodeMode -
    • getColorModel

      public ColorModel getColorModel()
      Get the color model that should be used now
      Returns:
    • decode

      private BufferedImage decode() throws IOException
      Attempt to decode the jpeg data
      Returns:
      the successfully decoded image
      Throws:
      IOException - if the image couldn't be decoded due to a lack of support or some IO problem
    • readImage

      private BufferedImage readImage(ImageReader jpegReader, ImageReadParam param) throws IOException
      Throws:
      IOException
    • getChild

      private Node getChild(Node aNode, String aChildName)
      Get a named child node
      Parameters:
      aNode - the node
      aChildName - the name of the child node
      Returns:
      the first direct child node with that name or null if it doesn't exist