Package org.zkoss.image

## Class Images

- java.lang.Object
- - org.zkoss.image.Images

-     public class Images
      extends java.lang.Object

  Utilities to handle images.
  Since:
    3.0.7
  Author:
    tomyeh

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `BASE64SPACERIMAGE` | A base64 string to display a spacer image.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Images()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Image` | `encode​(java.lang.String name, java.awt.image.RenderedImage image)` | Encodes an AWT image into a ZK image.
    `static Image` | `encode​(java.lang.String name, java.awt.image.RenderedImage image, float quality, boolean encodeAlpha)` | Encodes an AWT image into a ZK image (in PNG, JPEG or other format).

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### BASE64SPACERIMAGE

          public static final java.lang.String BASE64SPACERIMAGE

      A base64 string to display a spacer image.
      Since:
        9.6.0
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Images

          public Images()

  - ### Method Detail

    - #### encode

          public static Image encode​(java.lang.String name,
                                     java.awt.image.RenderedImage image,
                                     float quality,
                                     boolean encodeAlpha)
                              throws java.io.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:
        `java.lang.IllegalArgumentException` - if name doesn't contain an extension with supported format.
        `java.io.IOException`

    - #### encode

          public static Image encode​(java.lang.String name,
                                     java.awt.image.RenderedImage image)
                              throws java.io.IOException

      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:
        `java.lang.IllegalArgumentException` - if name doesn't contain an extension with supported format.
        `java.io.IOException`