sksamuel / scrimage

JVM - Java, Kotlin, Scala image processing library
https://sksamuel.github.io/scrimage
Apache License 2.0
1.05k stars 140 forks source link

Some Webp fail to parse #260

Closed sharmando closed 1 year ago

sharmando commented 1 year ago

I am not sure what's different in this Webp https://i3.pureformulas.net/images/product/large/kd-ultra-90-capsules-by-arthur-andrew-medical.webp (size = 30476) but I get the following exception:

com.sksamuel.scrimage.ImageParseException: Image parsing failed. Tried the following ImageReader implementations:
com.sksamuel.scrimage.webp.WebpImageReader@6145370b failed due to Cannot run program "/tmp/dwebp17312374118426277146binary": error=2, No such file or directory
com.sksamuel.scrimage.nio.ImageIOReader@5d22b682 failed due to No javax.imageio.ImageReader supported this image format
com.sksamuel.scrimage.nio.PngReader@7cb13d7 failed
com.sksamuel.scrimage.nio.OpenGifReader@2f5be812 failed due to Invalid GIF header.

The exception happened using Scrimage 4.0.31 and using doker base image eclipse-temurin:17.0.3_7-jre-alpine. While running the same program many other webp files parse just fine.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sharmando commented 1 year ago

I wonder if this is related to https://github.com/sksamuel/scrimage/issues/259

sksamuel commented 1 year ago

I have added a test for this and it seems to parse fine. In addition, the error in your paste says that it cannot find the file, not that it could not parse it, see Cannot run program "/tmp/dwebp17312374118426277146binary": error=2, No such file or directory So maybe that's the cause?

sharmando commented 1 year ago

Right, the error says it cannot find a webp binary, is it possible I need to install something and my doker base image eclipse-temurin:17.0.3_7-jre-alpine is the issue or does scrimage includes the webp binaries?

sksamuel commented 1 year ago

Scrimage includes them.

sharmando commented 1 year ago

Okay, I managed to make the test pass in my project. Scrimage must be checking for binaries inside my resources. After deleting resources/webp_binaries/dwebp (has been there since 2020) the test passes.

Thank you!