Package org.zkoss.image
Class Images
java.lang.Object
org.zkoss.image.Images
Utilities to handle images.
- Since:
- 3.0.7
- Author:
- tomyeh
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Imageencode(String name, RenderedImage image) Encodes an AWT image into a ZK image.static Imageencode(String name, RenderedImage image, float quality, boolean encodeAlpha) Encodes an AWT image into a ZK image (in PNG, JPEG or other format).
-
Field Details
-
BASE64SPACERIMAGE
A base64 string to display a spacer image.- Since:
- 9.6.0
- See Also:
-
-
Constructor Details
-
Images
public Images()
-
-
Method Details
-
encode
public static Image encode(String name, RenderedImage image, float quality, boolean encodeAlpha) throws IOException Encodes an AWT image into a ZK image (in PNG, JPEG or other format).- Parameters:
name- The name of the image. The extension of the name must be the format. Supported format: png and jpeg. For example, foo.png and foo.jpeg.image- The AWT image to be encoded.quality- The quality to use for the image encoding. It is a number between 0 and 1. The higher the value, the better the output quality. Not applicable to "png".encodeAlpha- Whether to encode alpha transparency. Not applicable to "png".- Throws:
IllegalArgumentException- if name doesn't contain an extension with supported format.IOException
-
encode
Encodes an AWT image into a ZK image.- Parameters:
name- The name of the image. The extension of the name must be the format. For example, foo.png and foo.jpeg.image- The AWT image to be encoded.- Throws:
IllegalArgumentException- if name doesn't contain an extension with supported format.IOException
-