ImageIO and JAI do not have support for reading the WebP file format. In order to do so you need to find a third party library, for example luciad (can be cloned from here). Due to this lack of support we decided to create JDeli, which does not make use of ImageIO and allows you to read WebP images out of the box.
First an introduction to WebP images…
What is WebP?
WebP images were created by Google to work on web browsers. They are designed to be small and therefore fast to load, using both lossy and lossless compression. You can read more about the WebP image format in our previous article here.
To read a webp image using a third party library such as luciad:
BufferedImage image = ImageIO.read(new File("input.webp"));
WebpDecoder decoder = new WebpDecoder(); BufferedImage image = decoder.read(webpByteData);
You can find more tutorials in our series on handling common image formats in Java, JDeli and other image libraries.
Latest posts by Bethan Palmer (see all)
- Business of Software days 2 and 3 – key takeaways - September 21, 2017
- My key takeaways from Josh Kaufman’s ‘The Personal MBA’ - August 30, 2017
- 5 thing I learned from reading Nathan Chan’s Foundr book - August 24, 2017
- 3 questions raised by Dan Lyons’ ‘Disrupted’ - August 9, 2017
- 6 Things To Read On Your Summer Holiday - August 2, 2017