Skip to content
Chris Kroells edited this page Jan 18, 2022 · 5 revisions

Frequently Asked Questions

Which image formats are supported by Thumbnailator?

The image reading and writing functionality of Thumbnailator is dependent on the capability of the Java Image I/O API which the library uses.

By default, Java 6 and beyond support reading and writing of JPEG, PNG, GIF, BMP and WBMP formats; Java 5 did not support writing GIF files.

List of supported formats for each Java release:

The Image I/O API has a plug-in mechanism to support additional image formats.

As Thumbnailator uses the Image I/O API, by using additional Image I/O plug-ins, it is possible to support more formats from within Thumbnailator.

For example, the TwelveMonkeys ImageIO library provides additional support for many image formats which are not by default in the Java runtime.

Why am I getting OutOfMemoryErrors and what can I do about it?

Thumbnailator needs to load the original image in order to resize the image. This requires (roughly speaking) at least double of width * height * 4 bytes of heap space. For example a 20 megapixel image requires 160 MB of heap.

If the Java Virtual Machine does have enough heap allocated to it, you'll likely encounter OutOfMemoryErrors. You'll need to adjust the JVM heap memory based on the expected image sizes that your application will handle.

How to configure the JVM heap is outside the scope of the Thumbnailator project. Please consult your JVM documentation on how to configure it.

There is a temporary workaround (not guaranteed to always work) to reduce the necessary memory. This workaround can be enabled by adding the -Dthumbnailator.conserveMemoryWorkaround=true JVM option. However, it can cause quality reduction in the final thumbnail. More information about this workaround can be found here.

Clone this wiki locally