Class ImageProcessingOperations
java.lang.Object
com.idrsolutions.image.process.ImageProcessingOperations
- All Implemented Interfaces:
ImageProcessingOps
Holds a list of image processing operations and applies them in the order
they were added. Each method that adds an operation returns this instance,
so calls can be chained.
Example:
ImageProcessingOperations operations = new ImageProcessingOperations()
.blur()
.crop(new Rectangle(0, 0, 100, 100));
BufferedImage processedImage = operations.apply(image);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(BufferedImage image) Applies the chosen image operation/operations to the image.blur()Adds the blur operation to a list of operations to be applied.brighten(float percent) Adds the Brighten operation to a list of operations to be applied.Adds the clip operation to a list of operations to be applied.Adds the crop operation to a list of operations to be applied.custom(ImageOperation custom) Adds the custom operation to a list of operations to be applied.Adds the edge detection operation to a list of operations to be applied.emboss()Adds the emboss operation to a list of operations to be applied.exposure(float exposure) Adds the exposure operation to a list of operations to be applied.Adds the gaussian blur operation to a list of operations to be applied.Adds the invert colors operation to a list of operations to be applied.kernel(float[] kernel) Adds the Kernel operation to a list of operations to be applied.mirror()Adds the mirror operation to a list of operations to be applied.mirror(com.idrsolutions.image.process.MirrorOperations mirrorOp) Adds the mirror operation to a list of operations to be applied.intReturns the number of operations that will be applied.qualityScale(double scaling) Adds the quality scale operation to a list of operations to be applied.redo()Adds back the operation most recently removed byundo().resizeToFit(int newWidth, int newHeight) Adds the resize to fit operation to a list of operations to be applied.resizeToHeight(int newHeight) Adds the resize to height operation to a list of operations to be applied.resizeToWidth(int newWidth) Adds the resize to width operation to a list of operations to be applied.rotate(double degrees) Adds the rotate operation to a list of operations to be applied.scale(double scaling) Adds the scale operation to a list of operations to be applied.scale(double scaling, int interpolation) Adds the scale operation to a list of operations to be applied.sharpen()Adds the sharpen operation to a list of operations to be applied.stretchToFill(int newWidth, int newHeight) Adds the stretch to fill operation to a list of operations to be applied.Adds the super scale 2x operation to a list of operations to be applied.thumbnail(int width, int height) Adds the thumbnail operation to a list of operations to be applied.toARGB()Adds the toARGB operation to a list of operations to be applied.toBinary()Adds the toBinary operation to a list of operations to be applied.Adds the toGrayscale operation to a list of operations to be applied.Adds the toIndexed operation to a list of operations to be applied.toRGB()Adds the toRGB operation to a list of operations to be applied.undo()Removes the most recently added operation.watermark(BufferedImage watermarkImage, Watermark.WatermarkPosition pos, AlphaComposite alphaComposite) Adds the watermark operation to a list of operations to be applied.watermark(Shape shape, Color color, Watermark.WatermarkPosition pos, AlphaComposite alphaComposite, Watermark.WatermarkShapeProperties properties) Adds the watermark operation to a list of operations to be applied.watermark(String text, Color color, Font font, Watermark.WatermarkPosition pos) Adds the watermark operation to a list of operations to be applied.Adds the watermark operation to a list of operations to be applied.
-
Constructor Details
-
ImageProcessingOperations
public ImageProcessingOperations()
-
-
Method Details
-
apply
Applies the chosen image operation/operations to the image.- Specified by:
applyin interfaceImageProcessingOps- Parameters:
image- BufferedImage to apply the processing operation to.- Returns:
- BufferedImage The new image.
-
blur
Adds the blur operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the blur operation.
-
custom
Adds the custom operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
custom- ImageOperation to be applied- Returns:
- This instance of ImageProcessingOperations that includes the custom operation.
-
clip
Adds the clip operation to a list of operations to be applied.If clipToShape is true, the result is the size of the shape's bounds and keeps only the pixels inside the shape. If it is false, the result is the same size as the image, and the area inside the shape is cleared to transparent (black for images without alpha).
- Parameters:
s- Shape to clip with, in image coordinatesclipToShape- true to keep only the area inside the shape, false to clear it- Returns:
- This instance of ImageProcessingOperations that includes the clip operation.
-
crop
Adds the crop operation to a list of operations to be applied.- Parameters:
rec- Rectangle to crop the image to. It must lie within the image bounds.- Returns:
- This instance of ImageProcessingOperations that includes the crop operation.
-
edgeDetection
Adds the edge detection operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the edge detection operation.
-
emboss
Adds the emboss operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the emboss operation.
-
exposure
Adds the exposure operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
exposure- float amount of exposure to apply- Returns:
- This instance of ImageProcessingOperations that includes the exposure operation.
-
gaussianBlur
Adds the gaussian blur operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the gaussian blur operation.
-
invertColors
Adds the invert colors operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the invert colors operation.
-
kernel
Adds the Kernel operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
kernel- float[] of kernel to apply- Returns:
- The updated ImageProcessingOperations that includes the kernel operation.
-
brighten
Adds the Brighten operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
percent- float percentage to brighten- Returns:
- The updated ImageProcessingOperations that includes the brighten operation.
-
mirror
Adds the mirror operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
mirrorOp- enum of which mirroring operation to do- Returns:
- This instance of ImageProcessingOperations that includes the mirror operation.
-
mirror
Adds the mirror operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the mirror operation.
-
resizeToFit
Adds the resize to fit operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
newWidth- Integer of new widthnewHeight- Integer of new height- Returns:
- This instance of ImageProcessingOperations that includes the resize to fit operation.
-
resizeToHeight
Adds the resize to height operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
newHeight- Integer of new height- Returns:
- This instance of ImageProcessingOperations that includes the resize to height operation.
-
resizeToWidth
Adds the resize to width operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
newWidth- Integer of new width- Returns:
- This instance of ImageProcessingOperations that includes the resize to width operation.
-
rotate
Adds the rotate operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
degrees- Double of degrees to rotate the image- Returns:
- This instance of ImageProcessingOperations that includes the rotate operation.
-
scale
Adds the scale operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
scaling- Double of scale to apply the image- Returns:
- This instance of ImageProcessingOperations that includes the scale operation.
-
scale
Adds the scale operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
scaling- Double of scale to be appliedinterpolation- Integer of interpolation to be applied- Returns:
- This instance of ImageProcessingOperations that includes the scale operation.
-
sharpen
Adds the sharpen operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the sharpen operation.
-
stretchToFill
Adds the stretch to fill operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
newWidth- Integer of new widthnewHeight- Integer of new height- Returns:
- This instance of ImageProcessingOperations that includes the stretch to fill operation.
-
superScale2x
Adds the super scale 2x operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the super scale 2x operation.
-
toARGB
Adds the toARGB operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the toARGB operation.
-
toBinary
Adds the toBinary operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the toBinary operation.
-
toGrayscale
Adds the toGrayscale operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the toGrayscale operation.
-
toIndexed
Adds the toIndexed operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the toIndexed operation.
-
toRGB
Adds the toRGB operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Returns:
- This instance of ImageProcessingOperations that includes the toRGB operation.
-
qualityScale
Adds the quality scale operation to a list of operations to be applied.
See the JDeli tutorials for more information on how to use this processing operation.- Parameters:
scaling- Double of the scale to be applied- Returns:
- This instance of ImageProcessingOperations that includes the quality scale operation.
-
thumbnail
Adds the thumbnail operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use.- Parameters:
width- Integer of the thumbnail widthheight- Integer of the thumbnail height- Returns:
- This instance of ImageProcessingOperations that includes the thumbnail operation.
-
watermark
public ImageProcessingOperations watermark(String text, Color color, Font font, Watermark.WatermarkPosition pos) Adds the watermark operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
text- String text to be displayed as watermark, '\n' will divide watermark across multiple linescolor- Color to be used to represent text watermarkfont- font style to represent text watermarkpos- Enum WatermarkPosition which represents the position of the Watermark for centre or fit to image position- Returns:
- This instance of ImageProcessingOperations that includes the watermark operation.
-
watermark
public ImageProcessingOperations watermark(String text, Color color, Font font, Watermark.WatermarkPosition pos, Rectangle rect) Adds the watermark operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
text- String text to be displayed as watermark, '\n' will divide watermark across multiple linescolor- Color to be used to represent text watermarkfont- font style to represent text watermarkpos- Enum WatermarkPosition which represents the position of the Watermark for centre, fit to image position or to the specified co-ordsrect- Rectangle that specifies the location of the watermark when USE_SHAPE_COORDINATES is set- Returns:
- This instance of ImageProcessingOperations that includes the watermark operation.
-
watermark
public ImageProcessingOperations watermark(BufferedImage watermarkImage, Watermark.WatermarkPosition pos, AlphaComposite alphaComposite) Adds the watermark operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
watermarkImage- BufferedImage of image to watermarkpos- Enum WatermarkPosition which represents the position of the Watermark for centre, fit to image position or to the specified co-ordsalphaComposite- AlphaComposite to be used when applying watermark- Returns:
- This instance of ImageProcessingOperations that includes the watermark operation.
-
watermark
public ImageProcessingOperations watermark(Shape shape, Color color, Watermark.WatermarkPosition pos, AlphaComposite alphaComposite, Watermark.WatermarkShapeProperties properties) Adds the watermark operation to a list of operations to be applied.
See JDeli tutorials for more information on how to use this processing operation.- Parameters:
shape- Shape to use when applying watermarkcolor- Color to be used to represent text watermarkpos- Enum WatermarkPosition which represents the position of the Watermark for centre, fit to image position or to the specified co-ordsalphaComposite- AlphaComposite to be used when applying watermarkproperties- Enum WatermarkShapeProperties to use when applying the watermark- Returns:
- The instance of ImageProcessingOperations that includes the watermark operation.
-
undo
Removes the most recently added operation. Up to 5 undone operations are kept so they can be restored withredo(). Does nothing if there are no operations.- Returns:
- This instance of ImageProcessingOperations.
-
redo
Adds back the operation most recently removed byundo(). Does nothing if there is nothing to redo.- Returns:
- This instance of ImageProcessingOperations.
-
operationsListSize
public int operationsListSize()Returns the number of operations that will be applied.- Returns:
- number of operations in the list
-