nintha / webp-imageio-core

Java Image I/O reader and writer for the Google WebP image format without system native libs
Apache License 2.0
158 stars 49 forks source link

Decode returned code VP8_STATUS_UNSUPPORTED_FEATURE for .webp animations #12

Closed naimen closed 4 years ago

naimen commented 4 years ago

I have this task of sending multiple pictures across the network, where the receiver end is Java, So I decided to serialize thoses images into a webp "animation" where each image is a frame. The webp is generated in python using PIL, and it's possible to decode and extract the frames on both python and Ezgif.com.

However when trying decode the same file, I get the following error

java.io.IOException: Decode returned code VP8_STATUS_UNSUPPORTED_FEATURE
at com.luciad.imageio.webp.WebP.decode(WebP.java:61)
at com.luciad.imageio.webp.WebPReader.read(WebPReader.java:158)
at java.desktop/javax.imageio.ImageReader.read(ImageReader.java:938)
at TestFrameGrab.testReadWebpLuciad(TestFrameGrab.java:29)

The test code:

    File inputWebp=new File("input.webp");
    File outputJpeg=new File("output.jpg");

    ImageReader reader = ImageIO.getImageReadersByMIMEType("image/webp").next();
    WebPReadParam readParam = new WebPReadParam();
    readParam.setBypassFiltering(true);

    reader.setInput(new FileImageInputStream(inputWebp));
    BufferedImage image = reader.read(0,readParam);
    ImageIO.write(image,"jpeg",outputJpeg);

The Python code to generate the file:

with open("input.webp","wb") as io:
    img.save(io, format='WebP', save_all=True, append_images=all_imgs, quality=80, lossless=True, allow_mixed=True)

I'm a bit clueless about what could have went wrong, any help or suggestions will be appreciated

nintha commented 4 years ago

This project just wrap java code and dll files. You may go to source repo luciad/webp-imageio , and create issue about supporting new feature of animation webp.