public class TurboJpeg
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
libturbojpeg |
lib |
|
jnr.ffi.Runtime |
runtime |
| Constructor | Description |
|---|---|
TurboJpeg() |
| Modifier and Type | Method | Description |
|---|---|---|
java.awt.image.BufferedImage |
decode(byte[] jpegData,
Info info,
java.awt.Dimension size) |
Decode the JPEG image in the input buffer into a BufferedImage.
|
java.nio.ByteBuffer |
encode(java.awt.image.Raster img,
int quality) |
Encode an image to JPEG
|
Info |
getInfo(byte[] jpegData) |
Return information about the JPEG image in the input buffer
|
java.nio.ByteBuffer |
transform(byte[] jpegData,
Info info,
java.awt.Rectangle region,
int rotation) |
Transform a JPEG image without decoding it fully
|
public libturbojpeg lib
public jnr.ffi.Runtime runtime
public Info getInfo(byte[] jpegData) throws TurboJpegException
jpegData - jpeg image dataTurboJpegException - if decompressing header with library failspublic java.awt.image.BufferedImage decode(byte[] jpegData,
Info info,
java.awt.Dimension size)
throws TurboJpegException
jpegData - JPEG data input bufferinfo - Information about the JPEG image in the buffersize - Target decompressed dimensions, must be among the available sizes (see Info.getAvailableSizes())TurboJpegException - if decompression with library failspublic java.nio.ByteBuffer encode(java.awt.image.Raster img,
int quality)
throws TurboJpegException
img - image as rectangle of pixelsquality - compression qualityTurboJpegException - if compression with library failspublic java.nio.ByteBuffer transform(byte[] jpegData,
Info info,
java.awt.Rectangle region,
int rotation)
throws TurboJpegException
jpegData - JPEG input bufferinfo - Information about the JPEG (from getInfo(byte[])region - Source region to crop out of JPEGrotation - Degrees to rotate the JPEG, must be 90, 180 or 270TurboJpegException - if image transformation failsCopyright © 2018. All rights reserved.