Coder Social home page Coder Social logo

webp4j's Introduction

webp4j

Simple Java webp image format encoder and decoder

WebP images are claimed to be 25-34% smaller than comparable JPEG images at equivalent SSIM quality index. https://developers.google.com/speed/webp/

webp4j uses JNI to link to native libwebp libraries (included into distribution jar).

Supported platforms:

  • Linux 32/64 bit
  • Windows 32/64 bit

Webp4j is on Bintray

Travis CI https://bintray.com/zakgof/maven/webp4j

Gradle

repositories {
    jcenter()
}

dependencies {
    compile 'com.github.zakgof:webp4j:0.0.2'
}

Usage

// Encode
BufferedImage bi = ...
float quality = 80f;
byte[] bytes = Webp4j.encode(bi, quality);

// Decode
BufferedImage restored = Webp4j.decode(bytes);

webp4j's People

Contributors

zakgof avatar

Stargazers

kohei sasaki avatar ³ʳᵈ avatar jordin avatar 3000IQPlay avatar Matt avatar Luis Majano avatar cici7758.com avatar 赵怡然 avatar Ali-RS avatar 捏造的信仰 avatar RainChan avatar iAnt avatar Guilherme Brandão avatar Anderson avatar  avatar

Watchers

 avatar  avatar

Forkers

wezell zhaodice

webp4j's Issues

java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3

HI,

Im not able to convert any PNG to WEBP but JPEG works fine for me. Code is simple:

BufferedImage image = ImageIO.read(inputStream);
return Webp4j.encode(image, WEBP_QUALITY);

as mention before, if i put a JPEG in the inputstream, it converts fine, but when I try with PNG, it throws an error:
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
at java.desktop/java.awt.image.ComponentSampleModel.getPixel(ComponentSampleModel.java:744) ~[na:na]
at java.desktop/java.awt.image.Raster.getPixel(Raster.java:1605) ~[na:na]
at com.zakgof.webp4j.BITools.scan(BITools.java:24) ~[webp4j-0.0.2.jar!/:na]
at com.zakgof.webp4j.Webp4j.encode(Webp4j.java:23) ~[webp4j-0.0.2.jar!/:na]

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.