Class OpenJpeg


  • public class OpenJpeg
    extends Object
    • Field Detail

      • COLOR_MODEL_CMYK

        public static final ColorModel COLOR_MODEL_CMYK
      • COLOR_MODEL_CMYK_ALPHA

        public static final ColorModel COLOR_MODEL_CMYK_ALPHA
      • runtime

        public jnr.ffi.Runtime runtime
    • Constructor Detail

      • OpenJpeg

        public OpenJpeg()
        Load the library.
    • Method Detail

      • getInfo

        public Info getInfo​(Path filePath)
                     throws IOException
        Obtain information about the JPEG200 image located at the given path.
        Throws:
        IOException
      • decode

        public BufferedImage decode​(InStreamWrapper wrapper,
                                    Rectangle area,
                                    int reduceFactor)
                             throws IOException
        Decode the JPEG2000 image in the input stream to a BufferedImage.
        Parameters:
        wrapper - Wrapper around the input stream pointing to the image
        area - Region of the image to decode
        reduceFactor - Scale down the image by a factor of 2^reduceFactor
        Returns:
        the decoded image
        Throws:
        IOException - if there's a problem decoding the image
      • decode

        public BufferedImage decode​(Path filePath,
                                    Rectangle area,
                                    int reduceFactor)
                             throws IOException
        Decode the JPEG2000 image located at the given path to a BufferedImage.
        Parameters:
        filePath - Path to the JPEG2000 image file.
        area - Region of the image to decode
        reduceFactor - Scale down the image by a factor of 2^reduceFactor
        Returns:
        the decoded image
        Throws:
        IOException - if there's a problem decoding the image or reading the file
      • encode

        public void encode​(Raster img,
                           OutStreamWrapper output,
                           opj_cparameters params)
                    throws IOException
        Encode a raster image to a JPEG2000 image.
        Parameters:
        img - image to encode
        output - wrapped OutputStream the image should be written to
        params - encoding parameters
        Throws:
        IOException - if encoding fails