In this blog post, we’ll take a quick look at how JDeli simplifies image editing for Java developers. The ideal image processing Java library should get you optimal results, and modify images without compromising quality.
Introduction
Image manipulation is a common requirement for many Java developers working with images, but finding a reliable, high-performance solution isn’t always straightforward. You need a Java Image processing library that modifies images with minimal code and maintains the integrity of the content.
JDeli offers a powerful enterprise alternative to standard libraries, making it easier to read, write, and manipulate images while supporting a wide range of formats. The Java Image processing library also supports formats not supported elsewhere such as Apple’s HEIC.
Why JDeli?
JDeli stands out for Java developers who need reliable image manipulation as it supports a wide range of formats and delivers high performance without relying on third-party dependencies. Its straightforward integration and clear documentation ensure peace of mind for enterprise users.
Its pure Java implementation, flexible licensing, and efficient handling of both simple and advanced image tasks make it a smart, future-proof choice for any Java imaging project. Its straightforward integration and clear documentation ensure peace of mind for teams.
Image Manipulation in Java
Below are all the features and capabilities for Java developers that JDeli offers to programmatically modify images.
Image Processing Features in JDeli
JDeli includes a large number of defined image processing operations, which you can apply to images. These are listed below.
You can also write your own in Java.
You can even combine multiple operations very easily like so!
operations.scale(1.2).sharpen().rotate(90);
All this makes JDeli a very powerful tool for Image Processing in Java.
Blur an Image in Java
You can apply a blur effect to your image using a 3×3 kernel matrix.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.blur();
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Brighten an Image in Java
The brighten operation will make the image brighter by the percent given.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.brighten(10); // Make the image 10% brighter
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Clip an Image in Java
The clip operation clips the image either to the specified shape or out the specified shape.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.clip(new Arc2D.Double(new Rectangle(0, 0, 100, 100), 0, 360, Arc2D.PIE), true); // Clip the image to a circle
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Create an Image thumbnail in Java
Generate a resized version of the image using the given dimensions. The scaling method is optimized to deliver the best quality when downsizing from the original image.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.thumbnail(64, 64);
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Crop an Image in Java
The crop operation crops the image at the position, width and height of the specified rectangle.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.crop(new Rectangle(10, 10, 100, 150)); // crop to a 100×150 rectangle at position 10,10
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Emboss an Image in Java
The emboss operation applies a 3×3 kernel matrix to give your image a raised, three-dimensional appearance.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.emboss();
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Invert colours an Image in Java
This class takes the input image and produces a version with inverted colours by applying negative ARGB values, giving it a visually reversed appearance.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.invertColors();
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Resize an Image in Java
The resize to fit operation scales an image to fit within a target rectangle while preserving aspect ratio so the result matches either the specified width or height but not both unless the aspect ratios match. You can configure our Java image resize library for the desired output.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.resizeToFit(100, 100); // make image fit into a box 100×100 pixels preserving aspect ratio
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Rotate an Image in Java
The rotate operation turns the image clockwise around its center by the specified number of degrees.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.rotate(90); // Rotate the image 90 degrees
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Scale an Image in Java
Scale operation will resize the image by the provided scaling factor specified as a double. The default scaling option used is AffineTransformOp.TYPE_BILINEAR.
Our Java image scaling library can be configured according to your specific needs.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.scale(1.2); //this will use AffineTransformOp.TYPE_BILINEAR
//operations.scale(scalingFactor, AffineTransformOp.TYPE_BICUBIC); //AffineTransformOp.VALUE
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Sharpen an Image in Java
The sharpen operation enhances image details by applying a 3×3 kernel matrix, making edges and textures appear more defined.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.sharpen();
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Add a text watermark to an Image in Java
The watermark operation adds text, a shape, or an image as a watermark. You can customize it using various parameters, including position options like FitToImage, Center, or USE_SHAPE_COORDINATES.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.watermark("Watermark Text", Color.BLUE, new Font("Arial", Font.BOLD, 30), FitToImage);
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Mirror an Image in Java
The mirror operation creates a flipped version of an image, either horizontally or vertically, depending on the selected direction.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.mirror(MirrorOperations.HORIZONTAL); // use MirrorOperations to specify the mirroring operation to use
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Stretch an Image to Fill in Java
The stretch to fill operation expands an image to completely occupy a specified pixel rectangle. It does not preserve aspect ratio, so the image is distorted to match both the defined width and height.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.stretchToFill(100, 100); // make image fill into a box 100×100 pixels
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Apply Edge detection to an Image in Java
The edge detection operation highlights the boundaries within an image by applying a 3×3 kernel matrix to identify changes in intensity.
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.edgeDetection();
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
Custom Operations in JDeli
The custom operation lets you integrate your own image processing code, enabling tailored functionality.
private class MyCustomImageOperation implements ImageOperation {
private Object myArgs;
public MyCustomImageOperations(Object myArgs) {
this.myArgs = myArgs;
}
@Override
public BufferedImage apply(BufferedImage image) {
//process code here
return image;
}
}
ImageProcessingOperations operations = new ImageProcessingOperations();
// You can chain several operations here such as scale, blur, etc
operations.custom(new MyCustomImageOperations());
// Apply the operations to a BufferedImage
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
In this tutorial you learned how to modify images in Java using our image processing Java library. To test on your own files, you can download the JDeli trial jar and understand how well it integrates with your system.
Are you a Java Developer working with Image files?
// Read an image
BufferedImage bufferedImage = JDeli.read(dicomImageFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(heicImageFile);
// Write an image
JDeli.write(bufferedImage, "heic", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(jpegImageFile);
// Write an image
JDeli.write(bufferedImage, "jpeg", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(jpeg2000ImageFile);
// Write an image
JDeli.write(bufferedImage, "jpx", outputStreamOrFile);
// Write an image
JDeli.write(bufferedImage, "pdf", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(pngImageFile);
// Write an image
JDeli.write(bufferedImage, "png", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(tiffImageFile);
// Write an image
JDeli.write(bufferedImage, "tiff", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(webpImageFile);
// Write an image
JDeli.write(bufferedImage, "webp", outputStreamOrFile);
What is JDeli?
JDeli is a commercial Java Image library that is used to read, write, convert, manipulate and process many different image formats.
Why use JDeli?
To handle many well known formats such as JPEG, PNG, TIFF as well as newer formats like AVIF, HEIC and JPEG XL in java with no calls to any external system or third party library.
What licenses are available?
We have 3 licenses available:
Server for on premises and cloud servers, Distribution for use in a named end user applications, and Custom for more demanding requirements.
How does JDeli compare?
We work hard to make sure JDeli performance is better than or similar to other java image libraries. Check out our benchmarks to see just how well JDeli performs.