@Role
public interface ImageProcessor
Modifier and Type | Method and Description |
---|---|
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.
|
Image readImage(InputStream inputStream) throws IOException
inputStream
- the input stream to read the image fromIOException
- if reading the image failsvoid writeImage(RenderedImage image, String mimeType, float quality, OutputStream out) throws IOException
image
- the image to be written to the output streammimeType
- 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
imageout
- the output stream to write the image toIOException
- if writing the image failsRenderedImage scaleImage(Image image, int width, int height)
image
- the image to be scaledwidth
- the new image widthheight
- the new image heightboolean isMimeTypeSupported(String mimeType)
mimeType
- the mime type to be checkedtrue
if the given mime type is supported, false
otherwiseCopyright © 2004–2017 XWiki. All rights reserved.