Giter Site home page Giter Site logo

simplewebp's Introduction

SimpleWEBP

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.

Feature

  • Supports Java 8+;
  • Only requires the java.base module;
  • Very small (< 25 KiB);
  • Supports reading VP8L WEBP images;
  • Supports alpha channels;

Limitations

  • Currently only VP8L WEBP is supported

Adding SimpleWEBP to your build

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

Use SimpleWEBP without JavaFX / Java AWT (imageio):

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%")

Use SimpleWEBP in a JavaFX project:

<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%")

Use SimpleWEBP in a Java AWT (imageio) project:

<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%")

Usage

VP8LDeocder is used to decode Webp.

Primitive Usage

public final class Example {
    private Example() {
    }

    public static void main(String[] args) throws IOException {
        RGBABuffer rgbaBuffer = SimpleWEBPLoader.decode(Example.class.getResourceAsStream("example.webp"));
    }
}

Usage with JavaFX

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"));
    }
}

Usage with Java AWT

public final class AWTExample {
    private AWTExample() {
    }

    public static void main(String[] args) throws IOException {
        Image image = AWTImageLoader.decode(Example.class.getResourceAsStream("example.webp"));
    }
}

simplewebp's People

Contributors

burningtnt avatar

Stargazers

 avatar BX Zhang avatar 秋 雨落 avatar LJS80 avatar

Watchers

 avatar

Forkers

iafenvoy

simplewebp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.