JDeli is the industry-leading, high-performance replacement for the default javax.imageio.ImageIO package. It resolves common issues associated with the standard library, offering up to 7X faster image loading and significantly lower peak memory consumption, making it the definitive memory efficient Java image library.
TL;DR
- Speed: JDeli is up to 10x faster than ImageIO (for TIFF writing) and over 7x faster for standard PNG decoding.
- Stability/Memory: JDeli is written fully in Java, preventing the notorious JVM crashes caused by native code dependencies in ImageIO and offering more stable memory management.
- Modern Formats: Supports critical modern formats missing in core Java, including HEIC, AVIF, and JPEG XL.
- Performance Detail: Reads JPEG 2000 files over 2.5x faster than ImageIO with the JAI plugin.
Why Replace ImageIO?
Core Issues with the Default Java ImageIO
Limited Modern and Complex Format Support The default library lacks native support for essential contemporary formats and complex professional formats.
This forces developers to rely on unstable, often deprecated third-party plugins (like JAI), which only partially address the problem. For example, ImageIO offers no native support for crucial modern formats like HEIC (used by Apple) or complex formats like JPEG 2000 and AVIF.
Unoptimized Decoders Lead to Slow Performance ImageIO’s decoders rely on older, often unoptimized implementations, leading to a bottleneck in processing high-resolution images. This results in slow throughput, especially when processing large batches of images common in web services or data pipelines.
Performance benchmarks show ImageIO is often significantly slower than specialized libraries for common operations, sometimes lagging by over 7x (as seen in PNG decoding).
Poor Memory Management and JVM Crash Risk ImageIO is notorious for its poor memory management. It frequently requires loading the entire, uncompressed image into memory using non-optimized data structures.
Furthermore, its reliance on unstable, platform-specific native (C/C++) code dependencies often leads to uncontrolled memory usage outside the Java Heap. This dramatically increases the risk of the dreaded OutOfMemoryError and can cause entire JVM crashes on server-side or cloud deployments.
JDeli as the Superior Drop-in Replacement
JDeli is engineered from the ground up to be a robust, high-performance, and stable alternative to ImageIO, designed for the demands of modern Java ecosystems.
Structure: JDeli provides familiar reading and writing APIs that can easily replace existing ImageIO functions with minimal code changes.
Key Feature: JDeli utilizes a completely optimized, low-level Java implementation instead of relying on the legacy Sun/Oracle code base or problematic third-party native binaries.
This eliminates the root cause of ImageIO’s instability and ensures superior speed and memory management across all supported platforms.
JDeli vs ImageIO Overview
Below you can find a comparison between JDeli and ImageIO, and how both are designed for different use cases:
| Feature / Metric | Default Java ImageIO | JDeli Java Image Library |
|---|---|---|
| Code Base Stability | Relies heavily on unstable native code (C/C++), often via JAI plugins. | 100% Pure Java Core for all primary formats. Optional native acceleration is integrated and vetted. |
| Crash Risk (OOM/JVM) | High Risk. Prone to OutOfMemoryError and JVM crashes due to unmanaged off-heap memory allocation. | Zero Risk from unmanaged native code. Prevents heap-related JVM crashes by controlling memory usage within the Java Heap. |
| Peak Memory Usage (PMU) | High. Loads entire uncompressed image into non-optimized BufferedImage structures. Lacks memory control. | Low. Features optimized memory handling and a specific low-memory mode for significant PMU reduction. |
| Modern Format Support | Poor. Requires unstable plugins for JPEG 2000, and generally lacks HEIC, AVIF, and JPEG XL. | Excellent. Natively supports all critical modern formats (HEIC, AVIF, JPEG 2000, WebP). |
| Multithreading Support | Limited and often non-thread-safe when dealing with native code dependencies. | Full multithreading support available for concurrent image processing, aiding performance. |
Code Example: JDeli for Memory-Efficient Image Processing
This example shows how simple it is to use JDeli to read and write a HEIC image, demonstrating the replacement capability while implicitly utilizing its high-performance, memory-optimized core.
// Read HEIC files
JDeli.read(File heicFile);
JDeli.read(byte[] heicData);
JDeli.read(InputStream heicStream);
// Write HEIC files
JDeli.write(myBufferedImage, "heic");
// Convert to and from HEIC files
JDeli.convert(File inFile, File outFile);
JDeli.convert(InputStream inStream, OutputStream outStream, String format);
byte[] outputData=JDeli.convert(byte[] inputData, String format);
Conclusion
For Java developers seeking a powerful and stable alternative, JDeli is the clear answer, designed to replace the outdated ImageIO. It is the definitive memory-efficient Java image library, eliminating the instability risks of native code while delivering superior speed.
Benchmarks Resources
The benchmarks mentioned in this post were performed using the Java Microbenchmark Harness test. If you’re curious, you can view the detailed results of the test.
Are you a Java Developer working with Image files?
// Read an image
BufferedImage bufferedImage = JDeli.read(avifImageFile);
// 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.