Interface ImageProcessor

All Known Implementing Classes:
ImgSclrProcessor

@API(status=STABLE, since="1.0", consumers="ImgSclrProcessor") @Component public interface ImageProcessor
A simple image processor with some useful basic functionality in applications. The implementation is a wrapper for the Java2D & imgscalr.
Since:
1.0
Version:
1.2
Author:
elmar.dott@gmail.com
  • Field Details

    • FEATURE_ID

      @API(status=STABLE, since="1.2") static final String FEATURE_ID
      Identifier for the given feature.
      See Also:
    • FORMAT_JPEG

      @API(status=STABLE, since="3.0") static final String FORMAT_JPEG
      Supported JPEG file format.
      See Also:
    • FORMAT_JPG

      @API(status=STABLE, since="1.0") static final String FORMAT_JPG
      Supported JPG file format.
      See Also:
    • FORMAT_GIF

      @API(status=STABLE, since="1.0") static final String FORMAT_GIF
      Supported GIF file format.
      See Also:
    • FORMAT_PNG

      @API(status=STABLE, since="1.0") static final String FORMAT_PNG
      Supported PNG file format.
      See Also:
  • Method Details

    • loadImage

      @API(status=STABLE, since="1.0") boolean loadImage(BufferedImage image)
      Load an BufferdImage. In te case an image is already loaded, this method overwrite the previous image.
      Parameters:
      image - as BufferdImage
      Returns:
      true on success
    • loadImage

      @API(status=STABLE, since="1.0") boolean loadImage(File image)
      Load an image from a file. In te case an image is already loaded, this method overwrite the previous image.
      Parameters:
      image - as File
      Returns:
      true on success
    • isImageSet

      @API(status=DEPRECATED, since="1.1") boolean isImageSet()
      Test if an image is in the processor set.
      Returns:
      true on success
    • saveImage

      @API(status=STABLE, since="1.0") boolean saveImage(BufferedImage renderedImage, File file, String format) throws MisconfigurationException
      Save a modified image to a given name and path which is defined as file. Also the format (GIF, PNG, BMP or JPG) has to be defined.
      saveImage(renderedImage, new File("/my/file/image.png"), FORMAT_PNG);
      Parameters:
      renderedImage - as BufferedImage
      file - as File
      format - as String
      Returns:
      true on success
      Throws:
      MisconfigurationException
    • getHeight

      @API(status=STABLE, since="1.1") int getHeight()
      Get the height in pixel of the loaded image.
      Returns:
      height as int
    • getWidth

      @API(status=STABLE, since="1.1") int getWidth()
      Get the width in pixel of the loaded image.
      Returns:
      width as int
    • getImageSize

      @API(status=STABLE, since="1.1") long getImageSize(BufferedImage image)
      Calculate the size in bytes of the BufferdImage.
      Parameters:
      image - as BufferedImage
      Returns:
      imageSize as long
    • clearImage

      @API(status=STABLE, since="1.0") void clearImage()
      Reset the loaded image.
    • crop

      @API(status=STABLE, since="1.0") BufferedImage crop(int x, int y, int height, int width) throws MisconfigurationException
      Get from an given image an defined clipping. X and Y are the coordinates where the cropping starts. Height and width define an rectangle of the cropped area, which will be the new image.
      Parameters:
      x - as int
      y - as int
      height - as int
      width - as int
      Returns:
      renderdImage as BufferedImage
      Throws:
      MisconfigurationException
    • flipHorizontal

      @API(status=STABLE, since="1.0") BufferedImage flipHorizontal() throws MisconfigurationException
      Flip the image horizontaly.
      Returns:
      renderdImage as BufferedImage
      Throws:
      MisconfigurationException
    • flipVertical

      @API(status=STABLE, since="1.0") BufferedImage flipVertical() throws MisconfigurationException
      Flip the image verticaly.
      Returns:
      renderdImage as BufferedImage
      Throws:
      MisconfigurationException
    • getImage

      @API(status=STABLE, since="1.0") BufferedImage getImage()
      Get the original loaded Image.
      Returns:
      image as BufferedImage
    • resize

      @API(status=STABLE, since="1.0") BufferedImage resize(int percentage) throws MisconfigurationException
      Resize an given image to a new Size. The new scale is given in percent and is be automatic calculated from the original image. The calculation is rounded, because of the mathematic operation as Integer.
      calculation: int (original.size / 100) * percent
      Parameters:
      percentage - as int
      Returns:
      renderdImage as BufferedImage
      Throws:
      MisconfigurationException
    • rotateRight

      @API(status=STABLE, since="1.0") BufferedImage rotateRight() throws MisconfigurationException
      Rotate the image 90 degree steps to the right side. Clockwise rotation.
      Returns:
      renderdImage as BufferedImage
      Throws:
      MisconfigurationException
    • getMetaData

      @API(status=STABLE, since="2.1") List<org.apache.commons.imaging.common.ImageMetadata.ImageMetadataItem> getMetaData()
      Get the full list of ImageMetaData.
      Returns:
      ImageMetaData as List