Package org.europa.together.application
Class ImgSclrProcessor
java.lang.Object
org.europa.together.application.ImgSclrProcessor
- All Implemented Interfaces:
ImageProcessor
Implementation of a simple image processor.
-
Field Summary
Fields inherited from interface org.europa.together.business.ImageProcessor
FEATURE_ID, FORMAT_GIF, FORMAT_JPEG, FORMAT_JPG, FORMAT_PNG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReset the loaded image.copyImage(BufferedImage source) A deep copy of a BufferdImage (CopyConstructor).crop(int x, int y, int height, int width) Get from an given image an defined clipping.Flip the image horizontaly.Flip the image verticaly.intGet the height in pixel of the loaded image.getImage()Get the original loaded Image.longgetImageSize(BufferedImage image) Calculate the size in bytes of the BufferdImage.List<org.apache.commons.imaging.common.ImageMetadata.ImageMetadataItem> Get the full list of ImageMetaData.intgetWidth()Get the width in pixel of the loaded image.booleanTest if an image is in the processor set.booleanloadImage(BufferedImage image) Load an BufferdImage.booleanLoad an image from a file.resize(int percentage) Resize an given image to a new Size.Rotate the image 90 degree steps to the right side.booleansaveImage(BufferedImage renderedImage, File file, String format) Save a modified image to a given name and path which is defined as file.toString()
-
Constructor Details
-
ImgSclrProcessor
public ImgSclrProcessor()Constructor.
-
-
Method Details
-
loadImage
Description copied from interface:ImageProcessorLoad an BufferdImage. In te case an image is already loaded, this method overwrite the previous image.- Specified by:
loadImagein interfaceImageProcessor- Parameters:
image- as BufferdImage- Returns:
- true on success
-
loadImage
Description copied from interface:ImageProcessorLoad an image from a file. In te case an image is already loaded, this method overwrite the previous image.- Specified by:
loadImagein interfaceImageProcessor- Parameters:
imageFile- as File- Returns:
- true on success
-
saveImage
public boolean saveImage(BufferedImage renderedImage, File file, String format) throws MisconfigurationException Description copied from interface:ImageProcessorSave 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);- Specified by:
saveImagein interfaceImageProcessor- Parameters:
renderedImage- as BufferedImagefile- as Fileformat- as String- Returns:
- true on success
- Throws:
MisconfigurationException- case of error
-
getImageSize
Description copied from interface:ImageProcessorCalculate the size in bytes of the BufferdImage.- Specified by:
getImageSizein interfaceImageProcessor- Parameters:
image- as BufferedImage- Returns:
- imageSize as long
-
getHeight
public int getHeight()Description copied from interface:ImageProcessorGet the height in pixel of the loaded image.- Specified by:
getHeightin interfaceImageProcessor- Returns:
- height as int
-
getWidth
public int getWidth()Description copied from interface:ImageProcessorGet the width in pixel of the loaded image.- Specified by:
getWidthin interfaceImageProcessor- Returns:
- width as int
-
clearImage
public void clearImage()Description copied from interface:ImageProcessorReset the loaded image.- Specified by:
clearImagein interfaceImageProcessor
-
crop
Description copied from interface:ImageProcessorGet 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.- Specified by:
cropin interfaceImageProcessor- Parameters:
x- as inty- as intheight- as intwidth- as int- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException- case of error
-
flipHorizontal
Description copied from interface:ImageProcessorFlip the image horizontaly.- Specified by:
flipHorizontalin interfaceImageProcessor- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException- case of error
-
flipVertical
Description copied from interface:ImageProcessorFlip the image verticaly.- Specified by:
flipVerticalin interfaceImageProcessor- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException- case of error
-
getImage
Description copied from interface:ImageProcessorGet the original loaded Image.- Specified by:
getImagein interfaceImageProcessor- Returns:
- image as BufferedImage
-
resize
Description copied from interface:ImageProcessorResize 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- Specified by:
resizein interfaceImageProcessor- Parameters:
percentage- as int- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException- case of error
-
rotateRight
Description copied from interface:ImageProcessorRotate the image 90 degree steps to the right side. Clockwise rotation.- Specified by:
rotateRightin interfaceImageProcessor- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException- case of error
-
getMetaData
Description copied from interface:ImageProcessorGet the full list of ImageMetaData.- Specified by:
getMetaDatain interfaceImageProcessor- Returns:
- ImageMetaData as List
-
toString
-
isImageSet
public boolean isImageSet()Description copied from interface:ImageProcessorTest if an image is in the processor set.- Specified by:
isImageSetin interfaceImageProcessor- Returns:
- true on success
-
copyImage
Description copied from interface:ImageProcessorA deep copy of a BufferdImage (CopyConstructor).- Specified by:
copyImagein interfaceImageProcessor- Parameters:
source- as BufferedImage- Returns:
- a copied BufferedImage
-