Link

Custom Operation

What does it do?

The custom operation will allow you to add your own custom image processing operation code.

Example to apply your custom image processing operation

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);

Additional Code Examples

Process and convert between image formats using the following code examples:

Using File

File inputFile = new File("path/to/file");
File outputFile = new File("path/to/output-custom-file");
JDeli.convert(inputFile, outputFile, operations);

Using InputStream and OutputSteam

final InputStream inputStream = new FileInputStream(inputFile);
final OutputStream outputStream = new FileOutputStream(outputFile);
final String outputFormat = "format"; // format of the output file eg. png, jpeg,...;
JDeli.convert(inputStream, outputStream, outputFormat, operations);

Using byte[]

byte[] inputData = Files.readAllBytes(Paths.get("/path/to/file"));
final String outputFormat = "format"; // format of the output file eg. png, jpeg,...;
byte[] outputData = JDeli.convert(inputData, outputFormat, operations);

View Javadoc on the custom operation


Start Your Free Trial


Customer Downloads