Package org.libjpegturbo.turbojpeg
Class TJTransformer
java.lang.Object
org.libjpegturbo.turbojpeg.TJDecompressor
org.libjpegturbo.turbojpeg.TJTransformer
TurboJPEG lossless transformer
-
Field Summary
FieldsFields inherited from class org.libjpegturbo.turbojpeg.TJDecompressor
handle, jpegBuf, jpegBufSize, jpegHeight, jpegSubsamp, jpegWidth -
Constructor Summary
ConstructorsConstructorDescriptionCreate a TurboJPEG lossless transformer instance.TJTransformer(byte[] jpegImage) Create a TurboJPEG lossless transformer instance and associate the JPEG image stored injpegImagewith the newly-created instance.TJTransformer(byte[] jpegImage, int imageSize) Create a TurboJPEG lossless transformer instance and associate the JPEG image of lengthimageSizebytes stored injpegImagewith the newly-created instance. -
Method Summary
Modifier and TypeMethodDescriptionint[]Returns an array containing the sizes of the transformed JPEG images from the most recent call totransform().private voidinit()voidtransform(byte[][] dstBufs, TJTransform[] transforms, int flags) Losslessly transform the JPEG image associated with this transformer instance into one or more JPEG images stored in the given destination buffers.private int[]transform(byte[] srcBuf, int srcSize, byte[][] dstBufs, TJTransform[] transforms, int flags) transform(TJTransform[] transforms, int flags) Losslessly transform the JPEG image associated with this transformer instance and return an array ofTJDecompressorinstances, each of which has a transformed JPEG image associated with it.Methods inherited from class org.libjpegturbo.turbojpeg.TJDecompressor
close, decompress, decompress, decompress, decompress, decompressToYUV, decompressToYUV, finalize, getHeight, getJPEGBuf, getJPEGSize, getScaledHeight, getScaledWidth, getSubsamp, getWidth, setJPEGImage
-
Field Details
-
transformedSizes
private int[] transformedSizes
-
-
Constructor Details
-
TJTransformer
Create a TurboJPEG lossless transformer instance.- Throws:
Exception
-
TJTransformer
Create a TurboJPEG lossless transformer instance and associate the JPEG image stored injpegImagewith the newly-created instance.- Parameters:
jpegImage- JPEG image buffer (size of the JPEG image is assumed to be the length of the array)- Throws:
Exception
-
TJTransformer
Create a TurboJPEG lossless transformer instance and associate the JPEG image of lengthimageSizebytes stored injpegImagewith the newly-created instance.- Parameters:
jpegImage- JPEG image bufferimageSize- size of the JPEG image (in bytes)- Throws:
Exception
-
-
Method Details
-
transform
Losslessly transform the JPEG 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 Huffman decoding 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 image buffers.dstbufs[i]will receive a JPEG image that has been transformed using the parameters intransforms[i]. UseTJ.bufSize(int, int, int)to determine the maximum size for each buffer based on the cropped width and height.transforms- an array ofTJTransforminstances, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output imageflags- the bitwise OR of one or more ofTJ.FLAG_*- Throws:
Exception
-
transform
Losslessly transform the JPEG image associated with this transformer instance and return an array ofTJDecompressorinstances, each of which has a transformed JPEG image associated with it.- Parameters:
transforms- an array ofTJTransforminstances, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output imageflags- the bitwise OR of one or more ofTJ.FLAG_*- Returns:
- an array of
TJDecompressorinstances, each of which has a transformed JPEG image associated with it - Throws:
Exception
-
getTransformedSizes
Returns an array containing the sizes of the transformed JPEG images from the most recent call totransform().- Returns:
- an array containing the sizes of the transformed JPEG images from
the most recent call to
transform() - Throws:
Exception
-
init
- Throws:
Exception
-
transform
private int[] transform(byte[] srcBuf, int srcSize, byte[][] dstBufs, TJTransform[] transforms, int flags) throws Exception - Throws:
Exception
-