Back to Mozjpeg

TJTransformer

java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html

4.1.58.8 KB
Original Source

Package org.libjpegturbo.turbojpeg

Class TJTransformer


public classTJTransformerextends[TJDecompressor](TJDecompressor.html "class in org.libjpegturbo.turbojpeg")

TurboJPEG lossless transformer

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | TJTransformer() | Create a TurboJPEG lossless transformer instance. | | TJTransformer​(byte[] jpegImage) | Create a TurboJPEG lossless transformer instance and associate the JPEG source image stored in jpegImage with the newly created instance. | | TJTransformer​(byte[] jpegImage, int imageSize) | Create a TurboJPEG lossless transformer instance and associate the JPEG source image of length imageSize bytes stored in jpegImage with the newly created instance. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | int[] | getTransformedSizes() | Returns an array containing the sizes of the transformed JPEG images (in bytes) generated by the most recent transform operation. | | void | transform​(byte[][] dstBufs, TJTransform[] transforms) | Losslessly transform the JPEG source image associated with this transformer instance into one or more JPEG images stored in the given destination buffers. | | void | transform​(byte[][] dstBufs, TJTransform[] transforms, int flags) | Deprecated. Use TJDecompressor.set() and transform(byte[][], TJTransform[]) instead.

| | TJDecompressor[] | transform​(TJTransform[] transforms) | Losslessly transform the JPEG source image associated with this transformer instance and return an array of TJDecompressor instances, each of which has a transformed JPEG image associated with it. | | TJDecompressor[] | transform​(TJTransform[] transforms, int flags) | Deprecated. Use TJDecompressor.set() and transform(TJTransform[]) instead.

|

- 

Methods inherited from class org.libjpegturbo.turbojpeg.TJDecompressor

close, decompress, decompress, decompress, decompress, decompress, decompress12, decompress12, decompress16, decompress16, decompress8, decompress8, decompress8, decompress8, decompress8, decompressToYUV, decompressToYUV, decompressToYUV, decompressToYUV, decompressToYUV, decompressToYUV, finalize, get, getColorspace, getHeight, getJPEGBuf, getJPEGSize, getScaledHeight, getScaledWidth, getSubsamp, getWidth, set, setCroppingRegion, setScalingFactor, setSourceImage, setSourceImage

- 

Methods inherited from class java.lang.Object

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

Constructor Detail

- 

TJTransformer

public TJTransformer()
              throws[TJException](TJException.html "class in org.libjpegturbo.turbojpeg")

Create a TurboJPEG lossless transformer instance. Throws:TJException

- 

TJTransformer

public TJTransformer​(byte[] jpegImage)
              throws[TJException](TJException.html "class in org.libjpegturbo.turbojpeg")

Create a TurboJPEG lossless transformer instance and associate the JPEG source image stored in jpegImage with the newly created instance. Parameters:jpegImage - buffer containing the JPEG source image to transform. (The size of the JPEG image is assumed to be the length of the array.) This buffer is not modified.Throws:TJException

- 

TJTransformer

public TJTransformer​(byte[] jpegImage,
                     int imageSize)
              throws[TJException](TJException.html "class in org.libjpegturbo.turbojpeg")

Create a TurboJPEG lossless transformer instance and associate the JPEG source image of length imageSize bytes stored in jpegImage with the newly created instance. Parameters:jpegImage - buffer containing the JPEG source image to transform. This buffer is not modified.imageSize - size of the JPEG source image (in bytes)Throws:TJException

Method Detail

- 

transform

public void transform​(byte[][] dstBufs,[TJTransform](TJTransform.html "class in org.libjpegturbo.turbojpeg")[] transforms)
               throws[TJException](TJException.html "class in org.libjpegturbo.turbojpeg")

Losslessly transform the JPEG source image associated with this transformer instance into one or more JPEG images stored in the given destination buffers. Lossless transforms work by moving the raw coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this method provides a means of generating multiple transformed images from the same source or of applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times. Parameters:dstBufs - an array of JPEG destination buffers. dstbufs[i] will receive a JPEG image that has been transformed using the parameters in transforms[i]. Use TJ.bufSize() to determine the maximum size for each buffer based on the transformed or cropped width and height and the level of subsampling used in the destination image (taking into account grayscale conversion and transposition of the width and height.)transforms - an array of TJTransform instances, each of which specifies the transform parameters and/or cropping region for the corresponding transformed JPEG imageThrows:TJException

- 

transform

@Deprecated
public void transform​(byte[][] dstBufs,[TJTransform](TJTransform.html "class in org.libjpegturbo.turbojpeg")[] transforms,
                      int flags)
               throws[TJException](TJException.html "class in org.libjpegturbo.turbojpeg")

Deprecated. Use TJDecompressor.set() and transform(byte[][], TJTransform[]) instead.

Throws:TJException

- 

transform

public[TJDecompressor](TJDecompressor.html "class in org.libjpegturbo.turbojpeg")[] transform​([TJTransform](TJTransform.html "class in org.libjpegturbo.turbojpeg")[] transforms)
                           throws[TJException](TJException.html "class in org.libjpegturbo.turbojpeg")

Losslessly transform the JPEG source image associated with this transformer instance and return an array of TJDecompressor instances, each of which has a transformed JPEG image associated with it. Parameters:transforms - an array of TJTransform instances, each of which specifies the transform parameters and/or cropping region for the corresponding transformed JPEG imageReturns:an array of TJDecompressor instances, each of which has a transformed JPEG image associated with it.Throws:TJException

- 

transform

@Deprecated
public[TJDecompressor](TJDecompressor.html "class in org.libjpegturbo.turbojpeg")[] transform​([TJTransform](TJTransform.html "class in org.libjpegturbo.turbojpeg")[] transforms,
                                  int flags)
                           throws[TJException](TJException.html "class in org.libjpegturbo.turbojpeg")

Deprecated. Use TJDecompressor.set() and transform(TJTransform[]) instead.

Throws:TJException

- 

getTransformedSizes

public int[] getTransformedSizes()

Returns an array containing the sizes of the transformed JPEG images (in bytes) generated by the most recent transform operation. Returns:an array containing the sizes of the transformed JPEG images (in bytes) generated by the most recent transform operation.