How to make ImageIO support more format

I am currently writing an image converter in Java using ImageIO. Unfortunately, ImageIO does not support many formats. The javadoc says that it can be extended with plugins, but I cannot find them. I tried JAI (Java Advanced Imaging), but it seems this is a completely new library, not just for the plugin.

Do you have an idea how to make ImageIO more format?

+4
source share
2 answers

ImageIO uses the service provider's API, and most plugins use it as a jar that you just put in the classpath. ImageIO will automatically pick them up.

It is probably easier to give good answers if you list the supported formats.

As already mentioned, JAI adds some format support (note that you need jai-imageio.jar, not the full JAI package). A warning. Many of them require support for the built-in library, and the project seems to be left to Oracle's uncertainty.

I wrote a couple of plugins (mostly readers) that will expand the number of supported formats (primarily TIFF, PSD (Photoshop) and PICT, as well as expanded support for JPEG).

jrawio is another good example (as indicated in the comments) if you need support for the camera RAW file.

Googling brings up a lot more. As I said, it all depends on what formats you need.

+7
source

javax.imageio format support works based on the service provider's interface. SPI is just a special Jar that:

  • Provides a class for decoding / encoding an image.
  • Place the file in a specific place in the Jar to define a class that performs encoding and decoding.

AFAIU, JAI provides SPI for other formats not supported by "plain" ImageIO .

For more information, see Java TM Image I / O.

+2
source

Source: https://habr.com/ru/post/1485395/


All Articles