Link

Write image files

You can easily replace ImageIO just by adding jdeli jar to your Java classpath

For new code, JDeli works in a very similar way to ImageIO

For example to write a jpeg image:

File myNewJPegFile = new File("ImageAsJPeg.jpg");
ImageIO.write(myBufferedImage, "jpg", myNewJPegFile);

becomes:

File myNewJPegFile = new File("ImageAsJPeg.jpg");
JDeli.write(myBufferedImage, "jpg", myNewJPegFile);

The supported output formats are:

  • BMP
  • HEIF (soon)
  • JPEG
  • JPEG2000 (JP2 and JPX)
  • PNG
  • TIFF

There are also some new write method versions of JDeli.write.

OutputFormat version of JDeli.write

write(BufferedImage image, OutputFormat format, File output)
write(BufferedImage image, OutputFormat format, OutputStream output)

OutputFormat provides an Enum to set the Image type and lists all supported formats.

EncoderOptions version of JDeli.write

write(BufferedImage image, EncoderOptions options, File output)
write(BufferedImage image, EncoderOptions options, OutputStream output)

Each image format has a version of EncoderOptions (ie JpegEncoderOptions) which provides for complete control over output and allows image processing. Each Image format has its own specific options to set and get Image-specific values (ie TiffEncoderOptions allows access to xmp metadata for Tiff files).

The full Javadocs can be found here.

If you are looking to not change your code you can always use our ImageIO Plugin.

Still need help? Send us your questions.