Skip to content

Instantly share code, notes, and snippets.

@idr-solutions
idr-solutions / color-inversion.md
Created June 2, 2025 09:53
invert colors | color inversion | Invert image colors

Image Color Inversion in Java

You can use JDeli to achieve image color inversion in Java. JDeli is an enterprise-level Java image library that makes it easy to read, write, convert, manipulate and process HEIC and other image file formats in Java.

This class uses the provided image and returns an inverted image containing negative argb values image. This makes the image appear inverted.

Example in Java to invert colors of an image

ImageProcessingOperations operations = new ImageProcessingOperations();

// You can chain several operations here such as scale, blur, etc
@idr-solutions
idr-solutions / gaussian-blur.md
Created May 29, 2025 12:36
gaussian blur | gaussian blur image | gaussian blur java

Gaussian Blur an image in Java

You can use JDeli, the top enterprise-level Java image library to do Gaussian Blur. The Gaussian operation can be used to blur your image using a 3*3 kernel matrix.

Gaussian blur a BufferedImage in Java

ImageProcessingOperations operations = new ImageProcessingOperations();

// You can chain several operations here such as scale, blur, etc
operations.gaussianBlur(); 
@idr-solutions
idr-solutions / emboss-image.md
Created May 27, 2025 09:21
emboss an image | image emboss | emboss image

Emboss an image

You can use JDeli to emboss an image. JDeli is the top enterprise-level java image library.

Emboss operation can be used to emboss your image using a 3*3 kernel matrix.

Emboss a BufferedImage in Java

ImageProcessingOperations operations = new ImageProcessingOperations();

// You can chain several operations here such as scale, blur, etc
@idr-solutions
idr-solutions / change-pixel-depth-ColorSpace.md
Created May 22, 2025 08:13
change pixel depth | change ColorSpace

Change pixel depth and ColorSpace of an Image in java

It is possible to change the ColorSpace and bit depth used by an image with JDeli. This will alter both the appearance and output image size.

Image types supported by Java

Java provides a generic BufferedImage type which can have multiple types. The current type of a BufferedImage is easily discovered with this code

image.getType(); //returns an int value

Recommended values are:

@idr-solutions
idr-solutions / java-image-processing.md
Created May 21, 2025 07:59
java image processing | image processing in Java

Image processing in Java

The JDeli Java image processing library is able to process image files or images in memory. Multiple processing operations can be applied together with the convert or process methods.

Process an image file

JDeli.convert(File inputFile, File outputFile, ImageProcessingOperations operations);

JDeli can also convert between different image file formats at the same time.

@idr-solutions
idr-solutions / delete-pages-from-PDF.md
Created May 19, 2025 09:20
Delete Pages From PDF

Delete Pages from PDF

JPedal provides several methods to allow easy page deletion from PDF files. These tools will allow you to create a copy of the PDF with the given pages and their content removed from the PDF. The original file is left untouched by this process unless you overwrite it with the output.

Delete Pages from PDF with the Command-Line or another language

java -cp jpedal.jar org.jpedal.manipulator.PdfManipulator --removePage inputFile outputFile pageRange

The pageRange is a page range as defined by SetOfIntegerSyntax. This range defines the pages to be deleted. The following example deletes all pages from 2 to 100.

Blur an image in java

Blur operation can be used to blur your image using a 3 x 3 kernel matrix. To use the Blur operation, download JDeli. JDeli is an enterprise-level Java image library that makes it easy to read, write, convert, manipulate and process HEIC and other image file formats in Java.

Blur a BufferedImage in Java

ImageProcessingOperations operations = new ImageProcessingOperations();

// You can chain several operations here such as scale, blur, etc
operations.blur(); 

Read Image Metadata

JDeli is an enterprise-level Java image library that makes it easy to read, write, convert, manipulate and process HEIC and other image file formats in Java. It makes it very simple to access supported Metadata values.

Metadata imgMetadata = JDeli.getImageInfo(imgFile);

which can be cast to an Image specific version

HeicMetadata imgMetadata = (HeicMetadata) JDeli.getImageInfo(heicFile);
@idr-solutions
idr-solutions / create-thumbnail-in-java.md
Created April 24, 2025 08:48
Create thumbnail in java

Create a Thumbnail in Java

Note: you need JDeli Java image library to follow this tutorial

Create a copy of the image with the specified dimensions. This operation uses a scaling routine designed to produce best output when the specified dimensions are smaller than the original.

Scale a BufferedImage in Java

ImageProcessingOperations operations = new ImageProcessingOperations();

Split PDF page

JPedal provides several methods to allow easy splitting of PDF files into multiple new files. These tools will allow you to create multiple PDF files by splitting a given file into multiple new files. The original file is left untouched by this process.

Split a PDF into two files with the Command-Line or another language

java -cp jpedal.jar org.jpedal.tools.PdfPageSplit inputFile.pdf outputFolder pageToSplitAt

The pageToSplitAt variable defines which page of the file to split at. The first half of the file contains the specified page.