A zero-dependency minimalist Java library for reading WEBP files.
It is implemented in Java and independent of Java AWT (ImageIO) / JavaFX. It can be easily used with Android.
- Supports Java 8+;
- Only requires the
java.base
module; - Very small (< 25 KiB);
- Supports reading VP8L WEBP images;
- Supports alpha channels;
- Currently only VP8L WEBP is supported
Please configure JitPack as a repository.
Maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Gradle:
repositories {
maven(url = "https://jitpack.io")
}
Please replace %latest-commit-hash%
with the latest commit hash.
e.g. 624c20367a05583af8066907ff95f5e8276ad7f4
Maven:
<dependency>
<groupId>com.github.burningtnt.SimpleWEBP</groupId>
<artifactId>SimpleWEBP</artifactId>
<version>%latest-commit-hash%</version>
</dependency>
Gradle:
implementation("com.github.burningtnt.SimpleWEBP:SimpleWEBP:%latest-commit-hash%")
<dependency>
<groupId>com.github.burningtnt.SimpleWEBP</groupId>
<artifactId>jfx</artifactId>
<version>%latest-commit-hash%</version>
</dependency>
Gradle:
implementation("com.github.burningtnt.SimpleWEBP:jfx:%latest-commit-hash%")
<dependency>
<groupId>com.github.burningtnt.SimpleWEBP</groupId>
<artifactId>awt</artifactId>
<version>%latest-commit-hash%</version>
</dependency>
Gradle:
implementation("com.github.burningtnt.SimpleWEBP:awt:%latest-commit-hash%")
VP8LDeocder
is used to decode Webp.
public final class Example {
private Example() {
}
public static void main(String[] args) throws IOException {
RGBABuffer rgbaBuffer = SimpleWEBPLoader.decode(Example.class.getResourceAsStream("example.webp"));
}
}
You should install the WEBPImageLoader
.
public final class JavaFXExample {
private JavaFXExample() {
}
public static void main(String[] args) {
WEBPImageLoaderFactory.setupListener();
Image image = new Image(Example.class.getResourceAsStream("example.webp"));
}
}
public final class AWTExample {
private AWTExample() {
}
public static void main(String[] args) throws IOException {
Image image = AWTImageLoader.decode(Example.class.getResourceAsStream("example.webp"));
}
}