How to write a WebP image with ImageIO
- Download webp-imageio plugin and add it to your classpath.
- Create a File (or OutputStream) object
- Pass image, WebP type, and File (or OutputStream) object into write method
and the the Java code to write WebP with ImageIO…
How to write a WebP image with JDeli
- Add JDeli to your class or module path. (download link to the trial jar).
- Create a File (or OutputStream) object
- Pass image, WEBP type, and File (or OutputStream) object into write method
and the Java code to write WebP with JDeli…
In below picture, my original file was a .jpg image, and I used JDeli to write it out as a .webp image.
More on WebP
What are WebP files used for?
The WebP file format was developed by Google to provide high-quality lossy and lossless compression for web images. In this article, I will walk you through how to write out images as WebP images in Java. We also have a related article covering how to read WebP files in Java.
ImageIO does not support WebP images by default so you will need to use an ImageIO plugin or a WebP Java library. I will demonstrate using an Open source ImageIO plugin (which extends ImageIO to provide WebP support), and using the JDeli Image Library.
Which web browsers support WebP?
WebP is supported by the most popular web browsers including Google chrome, Safari, Microsoft edge, Mozilla firefox and many more.
How can JDeli help?
You can use JDeli to read, write and convert your images as it has WebP support. Visit our documentation to learn more about JDeli’s WebP support.
Are you a Java Developer working with Image files?
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.
I don’t see any difference between the lines of code for “how to write image with ImageIO” and “JDeli.” Did you accidentally copy the same lines of code to both examples?
Hi Roman. Thank you for letting us know, we must have missed that! We have now changed it and updated the article, hope that helps.