com.xpn.xwiki.plugin.image
Interface ImageProcessor


@Role
public interface ImageProcessor

Component used to process images.

Since:
2.5M2
Version:
$Id: 95c01353b77bc14af24a72c2e770cd5dfdf80a03 $

Method Summary
 boolean isMimeTypeSupported(String mimeType)
           
 Image readImage(InputStream inputStream)
          Reads an image from an input stream.
 RenderedImage scaleImage(Image image, int width, int height)
          Scales the given image to the specified dimensions.
 void writeImage(RenderedImage image, String mimeType, float quality, OutputStream out)
          Encodes the given image to match the specified mime type, if possible, and writes it to the output stream, using the specified compression quality if appropriate.
 

Method Detail

readImage

Image readImage(InputStream inputStream)
                throws IOException
Reads an image from an input stream.

Parameters:
inputStream - the input stream to read the image from
Returns:
the read image
Throws:
IOException - if reading the image fails

writeImage

void writeImage(RenderedImage image,
                String mimeType,
                float quality,
                OutputStream out)
                throws IOException
Encodes the given image to match the specified mime type, if possible, and writes it to the output stream, using the specified compression quality if appropriate.

Parameters:
image - the image to be written to the output stream
mimeType - the image mime type (e.g. (e.g. "image/jpeg" or "image/png")
quality - the compression quality; use this parameter to reduce the size, i.e. the number of bytes, of the image
out - the output stream to write the image to
Throws:
IOException - if writing the image fails

scaleImage

RenderedImage scaleImage(Image image,
                         int width,
                         int height)
Scales the given image to the specified dimensions.

Parameters:
image - the image to be scaled
width - the new image width
height - the new image height
Returns:
the scaled image

isMimeTypeSupported

boolean isMimeTypeSupported(String mimeType)
Parameters:
mimeType - the mime type to be checked
Returns:
true if the given mime type is supported, false otherwise


Copyright © 2004-2013 XWiki. All Rights Reserved.