Package org.libjpegturbo.turbojpeg

## Class TJDecompressor

- java.lang.Object
- - org.libjpegturbo.turbojpeg.TJDecompressor

- All Implemented Interfaces:
    `java.io.Closeable`, `java.lang.AutoCloseable`
  Direct Known Subclasses:
    `TJTransformer`

      public class TJDecompressor
      extends java.lang.Object
      implements java.io.Closeable

  TurboJPEG decompressor

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TJDecompressor()` | Create a TurboJPEG decompresssor instance.
    `TJDecompressor​(byte[] jpegImage)` | Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream stored in `jpegImage` with the newly created instance.
    `TJDecompressor​(byte[] jpegImage, int imageSize)` | Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with the newly created instance.
    `TJDecompressor​(YUVImage yuvImage)` | Create a TurboJPEG decompressor instance and associate the 8-bit-per-sample planar YUV source image stored in `yuvImage` with the newly created instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` | Free the native structures associated with this decompressor instance.
    `short[]` | `decompress12​(int pitch, int pixelFormat)` | Decompress the JPEG source image with 9 to 12 bits per sample associated with this decompressor instance and return a buffer containing a packed-pixel decompressed image with the same data precision.
    `void` | `decompress12​(short[] dstBuf, int x, int y, int pitch, int pixelFormat)` | Decompress the JPEG source image with 9 to 12 bits per sample associated with this decompressor instance and output a packed-pixel grayscale, RGB, or CMYK image with the same data precision to the given destination buffer.
    `short[]` | `decompress16​(int pitch, int pixelFormat)` | Decompress the JPEG source image with 13 to 16 bits per sample associated with this decompressor instance and return a buffer containing a packed-pixel decompressed image with the same data precision.
    `void` | `decompress16​(short[] dstBuf, int x, int y, int pitch, int pixelFormat)` | Decompress the JPEG source image with 13 to 16 bits per sample associated with this decompressor instance and output a packed-pixel grayscale, RGB, or CMYK image with the same data precision to the given destination buffer.
    `void` | `decompress8​(byte[] dstBuf, int x, int y, int pitch, int pixelFormat)` | Decompress the JPEG source image with 2 to 8 bits per sample, or decode the 8-bit-per-sample planar YUV source image, associated with this decompressor instance and output a packed-pixel grayscale, RGB, or CMYK image with the same data precision to the given destination buffer.
    `java.awt.image.BufferedImage` | `decompress8​(int bufferedImageType)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the 8-bit-per-sample packed-pixel decompressed/decoded image.
    `void` | `decompress8​(int[] dstBuf, int x, int y, int stride, int pixelFormat)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.
    `byte[]` | `decompress8​(int pitch, int pixelFormat)` | Decompress the JPEG source image with 2 to 8 bits per sample, or decode the 8-bit-per-sample planar YUV source image, associated with this decompressor instance and return a buffer containing a packed-pixel decompressed image with the same data precision.
    `void` | `decompress8​(java.awt.image.BufferedImage dstImage)` | Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel decompressed/decoded image to the given `BufferedImage` instance.
    `YUVImage` | `decompressToYUV​(int align)` | Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample unified planar YUV image and return a `YUVImage` instance containing the decompressed image.
    `YUVImage` | `decompressToYUV​(int[] strides)` | Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes and return a `YUVImage` instance containing the decompressed image planes.
    `void` | `decompressToYUV​(YUVImage dstImage)` | Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample planar YUV image and store it in the given `YUVImage` instance.
    `protected void` | `finalize()` |
    `int` | `get​(int param)` | Get the value of a decompression parameter.
    `int` | `getHeight()` | Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
    `byte[]` | `getICCProfile()` | Retrieve the ICC (International Color Consortium) color management profile (if any) that was previously extracted from the JPEG image associated with this decompressor instance (see `setSourceImage(byte[], int)`), and return a buffer containing the ICC profile.
    `int` | `getICCSize()` | Returns the size of the ICC profile (if any) that was previously extracted from the JPEG image associated with this decompressor instance (see `setSourceImage(byte[], int)`), or 0 if there is no ICC profile to retrieve.
    `byte[]` | `getJPEGBuf()` | Returns the JPEG buffer associated with this decompressor instance.
    `int` | `getJPEGSize()` | Returns the size of the JPEG image (in bytes) associated with this decompressor instance.
    `int` | `getWidth()` | Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
    `void` | `saveImage​(java.lang.String fileName, java.lang.Object image, int x, int y, int width, int pitch, int height, int pixelFormat)` | Save a packed-pixel image with 2 to 16 bits of data precision per sample from memory to disk.
    `void` | `set​(int param, int value)` | Set the value of a decompression parameter.
    `void` | `setCroppingRegion​(java.awt.Rectangle croppingRegion)` | Set the cropping region for partially decompressing a lossy JPEG image into a packed-pixel image.
    `void` | `setScalingFactor​(TJScalingFactor scalingFactor)` | Set the scaling factor for subsequent lossy decompression operations.
    `void` | `setSourceImage​(byte[] jpegImage, int imageSize)` | Associate the JPEG image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with this decompressor instance.
    `void` | `setSourceImage​(YUVImage srcImage)` | Associate the specified planar YUV source image with this decompressor instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TJDecompressor

          public TJDecompressor()
                         throws TJException

      Create a TurboJPEG decompresssor instance.
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor​(byte[] jpegImage)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream stored in `jpegImage` with the newly created instance. Refer to `setSourceImage(byte[], int)` for more details.
      Parameters:
        `jpegImage` - buffer containing a JPEG source image or tables-only datastream. (The size of the JPEG image or datastream is assumed to be the length of the array.) This buffer is not modified.
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor​(byte[] jpegImage,
                                int imageSize)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the JPEG source image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with the newly created instance. Refer to `setSourceImage(byte[], int)` for more details.
      Parameters:
        `jpegImage` - buffer containing a JPEG source image or tables-only datastream. This buffer is not modified.
        `imageSize` - size of the JPEG source image or tables-only datastream (in bytes)
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor​(YUVImage yuvImage)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the 8-bit-per-sample planar YUV source image stored in `yuvImage` with the newly created instance. Refer to `setSourceImage(YUVImage)` for more details.
      Parameters:
        `yuvImage` - `YUVImage` instance containing a planar YUV source image to be decoded. This image is not modified.
      Throws:
        `TJException`

  - ### Method Detail

    - #### setSourceImage

          public void setSourceImage​(byte[] jpegImage,
                                     int imageSize)
                              throws TJException

      Associate the JPEG image or "abbreviated table specification" (AKA "tables-only") datastream of length `imageSize` bytes stored in `jpegImage` with this decompressor instance. If `jpegImage` contains a JPEG image, then this image will be used as the source image for subsequent decompression operations. Passing a tables-only datastream to this method primes the decompressor with quantization and Huffman tables that can be used when decompressing subsequent "abbreviated image" datastreams. This is useful, for instance, when decompressing video streams in which all frames share the same quantization and Huffman tables. If a JPEG image is passed to this method, then the `parameters` that describe the JPEG image will be set when the method returns. If a JPEG image is passed to this method and `TJ.PARAM_SAVEMARKERS` is set to `2` or `4`, then the ICC profile (if any) will be extracted from the JPEG image. (`getICCProfile()` can then be used to retrieve the profile.)
      Parameters:
        `jpegImage` - buffer containing a JPEG source image or tables-only datastream. This buffer is not modified.
        `imageSize` - size of the JPEG source image or tables-only datastream (in bytes)
      Throws:
        `TJException`

    - #### setSourceImage

          public void setSourceImage​(YUVImage srcImage)

      Associate the specified planar YUV source image with this decompressor instance. Subsequent decompression operations will decode this image into a packed-pixel RGB or grayscale destination image. This method sets `TJ.PARAM_SUBSAMP` to the chrominance subsampling level of the source image.
      Parameters:
        `srcImage` - `YUVImage` instance containing a planar YUV source image to be decoded. This image is not modified.

    - #### getWidth

          public int getWidth()

      Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
        the width of the source image (JPEG or YUV) associated with this decompressor instance.

    - #### getHeight

          public int getHeight()

      Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
        the height of the source image (JPEG or YUV) associated with this decompressor instance.

    - #### set

          public void set​(int param,
                          int value)

      Set the value of a decompression parameter.
      Parameters:
        `param` - one of `TJ.PARAM_*`
        `value` - value of the decompression parameter (refer to `parameter documentation`)

    - #### get

          public int get​(int param)

      Get the value of a decompression parameter.
      Parameters:
        `param` - one of `TJ.PARAM_*`
      Returns:
        the value of the specified decompression parameter, or -1 if the value is unknown.

    - #### getICCProfile

          public byte[] getICCProfile()
                               throws TJException

      Retrieve the ICC (International Color Consortium) color management profile (if any) that was previously extracted from the JPEG image associated with this decompressor instance (see `setSourceImage(byte[], int)`), and return a buffer containing the ICC profile. Once the ICC profile is retrieved, it must be re-extracted before it can be retrieved again.
      Returns:
        a buffer containing the ICC profile
      Throws:
        `TJException`

    - #### getICCSize

          public int getICCSize()

      Returns the size of the ICC profile (if any) that was previously extracted from the JPEG image associated with this decompressor instance (see `setSourceImage(byte[], int)`), or 0 if there is no ICC profile to retrieve.
      Returns:
        the size of the ICC profile (if any) that was previously extracted from the JPEG image associated with this decompressor instance (see `setSourceImage(byte[], int)`), or 0 if there is no ICC profile to retrieve.

    - #### setScalingFactor

          public void setScalingFactor​(TJScalingFactor scalingFactor)

      Set the scaling factor for subsequent lossy decompression operations.
      Parameters:
        `scalingFactor` - `TJScalingFactor` instance that specifies a fractional scaling factor that the decompressor supports (see `TJ.getScalingFactors()`), or `TJ.UNSCALED` for no scaling. Decompression scaling is a function of the IDCT algorithm, so scaling factors are generally limited to multiples of 1/8. If the entire JPEG image will be decompressed, then the width and height of the scaled destination image can be determined by calling `scalingFactor.``getScaled()` with the JPEG image width and height (see `getWidth()` and `getHeight()`.) When decompressing into a planar YUV image, an intermediate buffer copy will be performed if the width or height of the scaled destination image is not an even multiple of the iMCU size (see `TJ.getMCUWidth()` and `TJ.getMCUHeight()`.) Note that decompression scaling is not available (and the specified scaling factor is ignored) when decompressing lossless JPEG images (see `TJ.PARAM_LOSSLESS`), since the IDCT algorithm is not used with those images. Note also that `TJ.PARAM_FASTDCT` is ignored when decompression scaling is enabled.

    - #### setCroppingRegion

          public void setCroppingRegion​(java.awt.Rectangle croppingRegion)
                                 throws TJException

      Set the cropping region for partially decompressing a lossy JPEG image into a packed-pixel image.
      Parameters:
        `croppingRegion` - `java.awt.Rectangle` instance that specifies a subregion of the JPEG image to decompress, or `TJ.UNCROPPED` for no cropping. The left boundary of the cropping region must be evenly divisible by the scaled iMCU width, which can be determined by calling `TJScalingFactor.getScaled()` with the specified scaling factor (see `setScalingFactor()`) and the iMCU width (see `TJ.getMCUWidth()`) for the level of chrominance subsampling in the JPEG image (see `TJ.PARAM_SUBSAMP`.) The cropping region should be specified relative to the scaled image dimensions. Unless `croppingRegion` is `TJ.UNCROPPED`, the JPEG header must be read (see `setSourceImage(byte[], int)`) prior to calling this method.
      Throws:
        `TJException`

    - #### getJPEGBuf

          public byte[] getJPEGBuf()

      Returns the JPEG buffer associated with this decompressor instance.
      Returns:
        the JPEG buffer associated with this decompressor instance.

    - #### getJPEGSize

          public int getJPEGSize()

      Returns the size of the JPEG image (in bytes) associated with this decompressor instance.
      Returns:
        the size of the JPEG image (in bytes) associated with this decompressor instance.

    - #### decompress8

          public void decompress8​(byte[] dstBuf,
                                  int x,
                                  int y,
                                  int pitch,
                                  int pixelFormat)
                           throws TJException

      Decompress the JPEG source image with 2 to 8 bits per sample, or decode the 8-bit-per-sample planar YUV source image, associated with this decompressor instance and output a packed-pixel grayscale, RGB, or CMYK image with the same data precision to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed/decoded image. This buffer should normally be `pitch * destinationHeight` bytes in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed/decoded. NOTE: If the source image is a lossy JPEG image, then `destinationHeight` is either the scaled JPEG height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getHeight()`) or the height of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationHeight` is the height of the source image.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `pitch` - bytes per row in the destination image. Normally this should be set to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`, if the destination image will be unpadded. (Setting this parameter to 0 is the equivalent of setting it to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`.) However, you can also use this parameter to specify the row alignment/padding of the destination image, to skip rows, or to decompress/decode into a specific region of a larger image. NOTE: If the source image is a lossy JPEG image, then `destinationWidth` is either the scaled JPEG width (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getWidth()`) or the width of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationWidth` is the width of the source image.
        `pixelFormat` - pixel format of the decompressed/decoded image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress8

          public byte[] decompress8​(int pitch,
                                    int pixelFormat)
                             throws TJException

      Decompress the JPEG source image with 2 to 8 bits per sample, or decode the 8-bit-per-sample planar YUV source image, associated with this decompressor instance and return a buffer containing a packed-pixel decompressed image with the same data precision.
      Parameters:
        `pitch` - see `decompress8(byte[], int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Returns:
        a buffer containing a packed-pixel decompressed image with 2 to 8 bits of data precision per sample.
      Throws:
        `TJException`

    - #### decompress12

          public void decompress12​(short[] dstBuf,
                                   int x,
                                   int y,
                                   int pitch,
                                   int pixelFormat)
                            throws TJException

      Decompress the JPEG source image with 9 to 12 bits per sample associated with this decompressor instance and output a packed-pixel grayscale, RGB, or CMYK image with the same data precision to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed image. This buffer should normally be `pitch * destinationHeight` samples in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed. NOTE: If the source image is a lossy JPEG image, then `destinationHeight` is either the scaled JPEG height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getHeight()`) or the height of the cropping region (see `setCroppingRegion()`.) If the source image is a lossless JPEG image, then `destinationHeight` is the height of the source image.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `pitch` - samples per row in the destination image. Normally this should be set to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`, if the destination image will be unpadded. (Setting this parameter to 0 is the equivalent of setting it to `destinationWidth * `TJ.getPixelSize`(pixelFormat)`.) However, you can also use this parameter to specify the row alignment/padding of the destination image, to skip rows, or to decompress into a specific region of a larger image. NOTE: If the source image is a lossy JPEG image, then `destinationWidth` is either the scaled JPEG width (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getWidth()`) or the width of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationWidth` is the width of the source image.
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress12

          public short[] decompress12​(int pitch,
                                      int pixelFormat)
                               throws TJException

      Decompress the JPEG source image with 9 to 12 bits per sample associated with this decompressor instance and return a buffer containing a packed-pixel decompressed image with the same data precision.
      Parameters:
        `pitch` - see `decompress12(short[], int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Returns:
        a buffer containing a packed-pixel decompressed image with 9 to 12 bits of data precision per sample.
      Throws:
        `TJException`

    - #### decompress16

          public void decompress16​(short[] dstBuf,
                                   int x,
                                   int y,
                                   int pitch,
                                   int pixelFormat)
                            throws TJException

      Decompress the JPEG source image with 13 to 16 bits per sample associated with this decompressor instance and output a packed-pixel grayscale, RGB, or CMYK image with the same data precision to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed image. This buffer should normally be `pitch * jpegHeight` samples in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed
        `pitch` - samples per row in the destination image. Normally this should be set to `jpegWidth * `TJ.getPixelSize`(pixelFormat)`, if the destination image will be unpadded. (Setting this parameter to 0 is the equivalent of setting it to `jpegWidth * `TJ.getPixelSize`(pixelFormat)`.) However, you can also use this parameter to specify the row alignment/padding of the destination image, to skip rows, or to decompress into a specific region of a larger image.
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress16

          public short[] decompress16​(int pitch,
                                      int pixelFormat)
                               throws TJException

      Decompress the JPEG source image with 13 to 16 bits per sample associated with this decompressor instance and return a buffer containing a packed-pixel decompressed image with the same data precision.
      Parameters:
        `pitch` - see `decompress16(short[], int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
      Returns:
        a buffer containing a packed-pixel decompressed image with 13 to 16 bits of data precision per sample.
      Throws:
        `TJException`

    - #### decompressToYUV

          public void decompressToYUV​(YUVImage dstImage)
                               throws TJException

      Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample planar YUV image and store it in the given `YUVImage` instance. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of a packed-pixel image. This method cannot be used to decompress JPEG source images with the CMYK or YCCK colorspace.

      NOTE: The planar YUV destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstImage` - `YUVImage` instance that will receive the planar YUV decompressed image. The level of subsampling specified in this `YUVImage` instance must match that of the JPEG image, and the width and height specified in the `YUVImage` instance must match the scaled JPEG width and height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, `getWidth()`, and `getHeight()`.)
      Throws:
        `TJException`

    - #### decompressToYUV

          public YUVImage decompressToYUV​(int[] strides)
                                   throws TJException

      Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes and return a `YUVImage` instance containing the decompressed image planes. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of a packed-pixel image. This method cannot be used to decompress JPEG source images with the CMYK or YCCK colorspace.
      Parameters:
        `strides` - an array of integers, each specifying the number of bytes per row in the corresponding plane of the YUV image. Setting the stride for any plane to 0 is the same as setting it to the scaled plane width (see `YUVImage`.) If `strides` is null, then the strides for all planes will be set to their respective scaled plane widths. You can adjust the strides in order to add an arbitrary amount of row padding to each plane.
      Returns:
        a `YUVImage` instance containing the decompressed image planes
      Throws:
        `TJException`

    - #### decompressToYUV

          public YUVImage decompressToYUV​(int align)
                                   throws TJException

      Decompress the 8-bit-per-sample JPEG source image associated with this decompressor instance into an 8-bit-per-sample unified planar YUV image and return a `YUVImage` instance containing the decompressed image. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of a packed-pixel image. This method cannot be used to decompress JPEG source images with the CMYK or YCCK colorspace.
      Parameters:
        `align` - row alignment (in bytes) of the YUV image (must be a power of 2.) Setting this parameter to n will cause each row in each plane of the YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)
      Returns:
        a `YUVImage` instance containing the unified planar YUV decompressed image
      Throws:
        `TJException`

    - #### decompress8

          public void decompress8​(int[] dstBuf,
                                  int x,
                                  int y,
                                  int stride,
                                  int pixelFormat)
                           throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel grayscale, RGB, or CMYK image to the given destination buffer.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstBuf` - buffer that will receive the packed-pixel decompressed/decoded image. This buffer should normally be `stride * destinationHeight` pixels in size. However, the buffer may also be larger, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed/decoded. NOTE: If the source image is a lossy JPEG image, then `destinationHeight` is either the scaled JPEG height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getHeight()`) or the height of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationHeight` is the height of the source image.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `stride` - pixels per row in the destination image. Normally this should be set to `destinationWidth`. (Setting this parameter to 0 is the equivalent of setting it to `destinationWidth`.) However, you can also use this parameter to skip rows or to decompress/decode into a specific region of a larger image. NOTE: If the source image is a lossy JPEG image, then `destinationWidth` is either the scaled JPEG width (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, and `getWidth()`) or the width of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then `destinationWidth` is the width of the source image.
        `pixelFormat` - pixel format of the decompressed/decoded image (one of `TJ.PF_*`)
      Throws:
        `TJException`

    - #### decompress8

          public void decompress8​(java.awt.image.BufferedImage dstImage)
                           throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and output an 8-bit-per-sample packed-pixel decompressed/decoded image to the given `BufferedImage` instance.

      NOTE: The destination image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.PARAM_STOPONWARNING` is set.)

      Parameters:
        `dstImage` - a `BufferedImage` instance that will receive the packed-pixel decompressed/decoded image. If the source image is a lossy JPEG image, then the width and height of the `BufferedImage` instance must match the scaled JPEG width and height (see `setScalingFactor()`, `TJScalingFactor.getScaled()`, `getWidth()`, and `getHeight()`) or the width and height of the cropping region (see `setCroppingRegion()`.) If the source image is a YUV image or a lossless JPEG image, then the width and height of the `BufferedImage` instance must match the width and height of the source image.
      Throws:
        `TJException`

    - #### decompress8

          public java.awt.image.BufferedImage decompress8​(int bufferedImageType)
                                                   throws TJException

      Decompress the 8-bit-per-sample JPEG source image or decode the planar YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the 8-bit-per-sample packed-pixel decompressed/decoded image.
      Parameters:
        `bufferedImageType` - the image type of the `BufferedImage` instance that will be created (for instance, `BufferedImage.TYPE_INT_RGB`)
      Returns:
        a `BufferedImage` instance containing the 8-bit-per-sample packed-pixel decompressed/decoded image.
      Throws:
        `TJException`

    - #### saveImage

          public void saveImage​(java.lang.String fileName,
                                java.lang.Object image,
                                int x,
                                int y,
                                int width,
                                int pitch,
                                int height,
                                int pixelFormat)
                         throws TJException

      Save a packed-pixel image with 2 to 16 bits of data precision per sample from memory to disk.
      Parameters:
        `fileName` - name of a file to which to save the packed-pixel image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension. Windows BMP files require 8-bit-per-sample data precision. When saving a PBMPLUS file, the source data precision (from 2 to 16 bits per sample) can be specified using `TJ.PARAM_PRECISION` and defaults to 8 if `TJ.PARAM_PRECISION` is unset.
        `image` - buffer containing a packed-pixel RGB, grayscale, or CMYK image to be saved. The buffer is a `byte` array if the image has 2 to 8 bits of data precision per sample and a `short` array otherwise.
        `x` - x offset (in pixels) of the region in the buffer from which to save the packed-pixel image
        `y` - y offset (in pixels) of the region in the buffer from which to save the packed-pixel image
        `width` - width (in pixels) of the region in the buffer from which to save the packed-pixel image
        `pitch` - samples per row in the packed-pixel buffer. Setting this parameter to 0 is the equivalent of setting it to `width * `TJ.getPixelSize`(pixelFormat)`.
        `height` - height (in pixels) of the region in the buffer from which to save the packed-pixel image
        `pixelFormat` - pixel format of the packed-pixel image (one of `TJ.PF_*`). If this parameter is set to `TJ.PF_GRAY`, then the image will be stored in PGM or 8-bit-per-pixel (indexed color) BMP format. Otherwise, the image will be stored in PPM or 24-bit-per-pixel BMP format. If this parameter is set to `TJ.PF_CMYK`, then the CMYK pixels will be converted to RGB using a quick & dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)
      Throws:
        `TJException`

    - #### close

          public void close()
                     throws TJException

      Free the native structures associated with this decompressor instance.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `java.io.Closeable`
      Throws:
        `TJException`

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`