Package helma.image

# Class ImageGenerator

java.lang.Object
helma.image.ImageGenerator

Direct Known Subclasses:
  `ImageIOGenerator`

public abstract class ImageGenerator extends Object
Factory class for generating Image objects from various sources.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static ImageGenerator`
`generator`

## Constructor Summary

Constructors
Constructor
Description
`ImageGenerator()`

## Method Summary

Modifier and Type
Method
Description
`ImageWrapper`
`createImage(byte[] src)`
`ImageWrapper`
`createImage(int w, int h)`
`ImageWrapper`
`createImage(ImageWrapper iw, BufferedImageOp imageOp)`
`ImageWrapper`
`createImage(ImageWrapper iw, ImageFilter filter)`
`ImageWrapper`
`createImage(InputStream input)`
`ImageWrapper`
`createImage(String filenamne)`
`ImageWrapper`
`createImage(URL url)`
`static ImageGenerator`
`getInstance()`
Returns an ImageGenerator singleton, creating it if necessary.
`Image`
`read(byte[] src)`
`Image`
`read(InputStream input)`
`Image`
`read(String filename)`
`Image`
`read(URL url)`
`abstract void`
`write(ImageWrapper wrapper, OutputStream out, String type, float quality, boolean alpha)`
Saves the image.
`abstract void`
`write(ImageWrapper wrapper, String filename, float quality, boolean alpha)`
Saves the image.

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

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

## Field Details

### generator

protected static ImageGenerator generator

## Constructor Details

### ImageGenerator

public ImageGenerator()

## Method Details

### getInstance

public static ImageGenerator getInstance()
Returns an ImageGenerator singleton, creating it if necessary. If the JIMI package is installed, an instance of `JimiGenerator` will be returned. Otherwise, if the javax.imageio package is available, an instance of `ImageIOGenerator` is returned. Additionally, the class of the ImageGenerator implementation to be used can be set using the `imageGenerator` property in either the app.properties or server.properties file.

Returns:
  a new ImageGenerator instance

### createImage

public ImageWrapper createImage(int w, int h)

Parameters:
  `w` - ...
  `h` - ...
Returns:
  ...

### createImage

public ImageWrapper createImage(byte[] src) throws IOException

Parameters:
  `src` - ...
Returns:
  ...
Throws:
  `IOException`

### createImage

public ImageWrapper createImage(String filenamne) throws IOException

Parameters:
  `filenamne` - ...
Returns:
  ...
Throws:
  `IOException`

### createImage

public ImageWrapper createImage(URL url) throws MalformedURLException, IOException

Parameters:
  `url` - ...
Returns:
  ...
Throws:
  `MalformedURLException`
  `IOException`

### createImage

public ImageWrapper createImage(InputStream input) throws IOException

Parameters:
  `input` - ...
Returns:
  ...
Throws:
  `IOException`

### createImage

public ImageWrapper createImage(ImageWrapper iw, ImageFilter filter)

Parameters:
  `iw` - ...
  `filter` - ...
Returns:
  ...

### createImage

public ImageWrapper createImage(ImageWrapper iw, BufferedImageOp imageOp)

Parameters:
  `iw` - ...
  `imageOp` - ...
Returns:
  ...

### read

public Image read(String filename) throws IOException

Parameters:
  `filename` - the filename of the image to create
Returns:
  the newly created image
Throws:
  `IOException`

### read

public Image read(URL url) throws IOException

Parameters:
  `url` - the URL of the image to create
Returns:
  the newly created image
Throws:
  `IOException`

### read

public Image read(byte[] src) throws IOException

Parameters:
  `src` - the data of the image to create
Returns:
  the newly created image
Throws:
  `IOException`

### read

public Image read(InputStream input) throws IOException

Parameters:
  `input` - the data of the image to create
Returns:
  the newly created image
Throws:
  `IOException`

### write

public abstract void write(ImageWrapper wrapper, String filename, float quality, boolean alpha) throws IOException
Saves the image. Image format is deduced from filename.

Parameters:
  `wrapper` -
  `filename` -
  `quality` -
  `alpha` -
Throws:
  `IOException`

### write

public abstract void write(ImageWrapper wrapper, OutputStream out, String type, float quality, boolean alpha) throws IOException
Saves the image. Image format is deduced from the dataSource.

Parameters:
  `wrapper` -
  `out` -
  `quality` -
  `alpha` -
Throws:
  `IOException`