Open zoff99 opened 5 months ago
Do you have the source image?
its not the image, for some reason when i run that multiplatform app via "./gradlew run" it works and when i package it it also works. but when i run the java commandline freehand it produces this error. i don't know really where to begin looking
Hi there,
I've a similar issue after adding the scrimage-webp
module to our dependencies, which starts to be frustrating as I can't find the origin, but I'll explain what I've found in case it helps (and you can help me, 🙏🏻 ):
Before:
We had both scrimage-core
and scrimage-formats-extra
dependencies and we are loading images with the following line of code: ImmutableImage.loader.fromStream(is)
. To put you more in context, I'm using Scala language and I run it locally with sbt, but I package it to a jar to deploy the code in an AWS lambda.
Change made:
We wanted to add the scrimage-webp
dependency so we could support that kind of image files. So I added that module to the dependencies.
After:
I have 2 different behaviours:
1. If I add the scrimage-webp
dependency on top of the list (before the other two mentioned above):
Locally: I can run it and process any kind of image (including webp) with no issues.
Packaged and deployed to an AWS Lambda:
I can upload webp image files and it runs successfully but then I have the error with jpg files:
2. If I add the scrimage-webp
dependency at the bottom of the list (after the other two mentioned above):
Locally: I can run it and process any kind of image (including webp) with no issues.
Packaged and deployed to an AWS Lambda:
I can upload any kind of image files and it runs successfully but then I have the error with webp files (as before adding the webp module):
It looks like a dependency issue, but I can't find the origin. For more details: I'm using the latest versions for the scrimage dependencies (4.2.0) and the runtime is Java 11.
Any ideas?
@sksamuel can we debug this together please? this would be really great. i am pretty sure its a path thats set wrong under some conditions.
i have made a minimal KMP example to show the issue. can you check it out please?
git clone https://github.com/zoff99/testbed_debug
TERM=dumb ./gradlew run
# input file exists?: true <-- it logs that the input file exists
# CTRL-C
it will happily use build/compose/tmp/prepareAppResources/background.jpg
and create /tmp/aa.webp
now when you package it and run it with java
./manual_run.sh build
# input file exists?: true <-- it logs that the input file exists
you can see it has the exception. but i can not figure out why it happens. the resouces path and the input file are there. can you please have a look?
input file exists?: true
output file: /tmp/aa.webp
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
com.sksamuel.scrimage.ImageParseException: Image parsing failed for JPEG. If the format is `webp` ensure you have a webp reader on your classpath, such as the `scrimage-webp` module. Tried the following ImageReader implementations:
com.sksamuel.scrimage.webp.WebpImageReader@3ad86bad failed due to java.io.IOException: [Decoding of /tmp/input71681690817620127webp failed., Status: 3(BITSTREAM_ERROR)]
at com.sksamuel.scrimage.nio.ImageReaders.read(ImageReaders.java:66)
at com.sksamuel.scrimage.nio.ImageReaders.read(ImageReaders.java:37)
at com.sksamuel.scrimage.nio.ImmutableImageLoader.load(ImmutableImageLoader.java:139)
at com.sksamuel.scrimage.nio.ImmutableImageLoader.fromFile(ImmutableImageLoader.java:106)
at MainKt.shrink_image_file(Main.kt:71)
thank you.
@sksamuel hope you are still around
something broke, i am not sure what