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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Reset the loaded image.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.int
Get the height in pixel of the loaded image.getImage()
Get the original loaded Image.long
getImageSize
(BufferedImage image) Calculate the size in bytes of the BufferdImage.List<org.apache.commons.imaging.common.ImageMetadata.ImageMetadataItem>
Get the full list of ImageMetaData.int
getWidth()
Get the width in pixel of the loaded image.boolean
Test if an image is in the processor set.boolean
loadImage
(BufferedImage image) Load an BufferdImage.boolean
Load 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.boolean
saveImage
(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:ImageProcessor
Load an BufferdImage. In te case an image is already loaded, this method overwrite the previous image.- Specified by:
loadImage
in interfaceImageProcessor
- Parameters:
image
- as BufferdImage- Returns:
- true on success
-
loadImage
Description copied from interface:ImageProcessor
Load an image from a file. In te case an image is already loaded, this method overwrite the previous image.- Specified by:
loadImage
in 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:ImageProcessor
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);
- Specified by:
saveImage
in interfaceImageProcessor
- Parameters:
renderedImage
- as BufferedImagefile
- as Fileformat
- as String- Returns:
- true on success
- Throws:
MisconfigurationException
-
getImageSize
Description copied from interface:ImageProcessor
Calculate the size in bytes of the BufferdImage.- Specified by:
getImageSize
in interfaceImageProcessor
- Parameters:
image
- as BufferedImage- Returns:
- imageSize as long
-
getHeight
public int getHeight()Description copied from interface:ImageProcessor
Get the height in pixel of the loaded image.- Specified by:
getHeight
in interfaceImageProcessor
- Returns:
- height as int
-
getWidth
public int getWidth()Description copied from interface:ImageProcessor
Get the width in pixel of the loaded image.- Specified by:
getWidth
in interfaceImageProcessor
- Returns:
- width as int
-
clearImage
public void clearImage()Description copied from interface:ImageProcessor
Reset the loaded image.- Specified by:
clearImage
in interfaceImageProcessor
-
crop
Description copied from interface:ImageProcessor
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.- Specified by:
crop
in interfaceImageProcessor
- Parameters:
x
- as inty
- as intheight
- as intwidth
- as int- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException
-
flipHorizontal
Description copied from interface:ImageProcessor
Flip the image horizontaly.- Specified by:
flipHorizontal
in interfaceImageProcessor
- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException
-
flipVertical
Description copied from interface:ImageProcessor
Flip the image verticaly.- Specified by:
flipVertical
in interfaceImageProcessor
- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException
-
getImage
Description copied from interface:ImageProcessor
Get the original loaded Image.- Specified by:
getImage
in interfaceImageProcessor
- Returns:
- image as BufferedImage
-
resize
Description copied from interface:ImageProcessor
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- Specified by:
resize
in interfaceImageProcessor
- Parameters:
percentage
- as int- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException
-
rotateRight
Description copied from interface:ImageProcessor
Rotate the image 90 degree steps to the right side. Clockwise rotation.- Specified by:
rotateRight
in interfaceImageProcessor
- Returns:
- renderdImage as BufferedImage
- Throws:
MisconfigurationException
-
getMetaData
Description copied from interface:ImageProcessor
Get the full list of ImageMetaData.- Specified by:
getMetaData
in interfaceImageProcessor
- Returns:
- ImageMetaData as List
-
toString
-
isImageSet
public boolean isImageSet()Description copied from interface:ImageProcessor
Test if an image is in the processor set.- Specified by:
isImageSet
in interfaceImageProcessor
- Returns:
- true on success
-