Package org.zkoss.image.encoder
Class JPEGEncoder
- java.lang.Object
-
- org.zkoss.image.encoder.JPEGEncoder
-
- All Implemented Interfaces:
ImageEncoder
public class JPEGEncoder extends java.lang.Object implements ImageEncoder
The encoder for encoding an image into the JPEG format- Since:
- 3.0.7
- Author:
- tomyeh
-
-
Constructor Summary
Constructors Constructor Description JPEGEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]encode(java.awt.image.RenderedImage image)Encodes an AWT image into a byte array in a particular format.floatgetQuality()Returns the quality of the image encoding.booleanisEncodingAlpha()Returns whether to encode the alpha transparency.voidsetEncodingAlpha(boolean encodeAlpha)Sets whether to encode the alpha transparency.voidsetQuality(float quality)Sets the quality of the image encoding.
-
-
-
Method Detail
-
encode
public byte[] encode(java.awt.image.RenderedImage image) throws java.io.IOExceptionDescription copied from interface:ImageEncoderEncodes an AWT image into a byte array in a particular format.- Specified by:
encodein interfaceImageEncoder- Throws:
java.io.IOException
-
getQuality
public float getQuality()
Returns the quality of the image encoding. It is a number between 0 and 1. The higher the value, the better the output quality.Default: 0.95f.
- Specified by:
getQualityin interfaceImageEncoder
-
setQuality
public void setQuality(float quality)
Description copied from interface:ImageEncoderSets the quality of the image encoding. Simply does nothing if the encoder does not support it.- Specified by:
setQualityin interfaceImageEncoder
-
isEncodingAlpha
public boolean isEncodingAlpha()
Description copied from interface:ImageEncoderReturns whether to encode the alpha transparency.- Specified by:
isEncodingAlphain interfaceImageEncoder
-
setEncodingAlpha
public void setEncodingAlpha(boolean encodeAlpha)
Description copied from interface:ImageEncoderSets whether to encode the alpha transparency. Simply does nothing if the encoder does not support it.- Specified by:
setEncodingAlphain interfaceImageEncoder
-
-