Interface ImageProcessor


  • @Role
    public interface ImageProcessor
    Component used to process images.
    Since:
    2.5M2
    Version:
    $Id: fe12747c0b679f24c976ac1fdb75ff5f7c1bc3c8 $
    • 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