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

does this mean animated webp can not convert to gif? #3

Closed VINO42 closed 5 years ago

VINO42 commented 5 years ago

I just try to convert an animated webp file to a animated gif file,when run the demo code something happened,this is the demo:

   `public static void main(String[] args) throws IOException {

    String inputPath = "/demo01.webp";String outputGifPath = "test_pic/test_.gif";

    // Obtain a WebP ImageReader instance
    ImageReader reader = ImageIO.getImageReadersByMIMEType("image/webp").next();
    // Configure decoding parameters
    WebPReadParam readParam = new WebPReadParam();
    readParam.setBypassFiltering(true);

    // Configure the input on the ImageReader
    try {
        reader.setInput(new FileImageInputStream(new File(inputPath)));
    } catch (IOException e) {
        e.printStackTrace();
    }

    // Decode the image
    BufferedImage image = reader.read(0, readParam);
    ImageIO.write(image, "gif", new File(outputGifPath));
}`

and this is the exception Exception in thread "main" 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 com.andy.main(Test.java:281)

should I compile the libwebp1.0.0 or the newer? 0.1.0 版本用的库是 libwebp0.4.2,比较老了, 你可以自己编译 mac 环境的 libwebp1.0.0 的动态链接库。我手上没有 mac 机器,无能为力。 https://segmentfault.com/a/1190000016324137

nintha commented 5 years ago

yep, you can compile the libwebp1.0.0 or the newer.