Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Read JPEG Files #284

Closed
homestar9 opened this issue Jan 16, 2024 · 5 comments
Closed

Unable to Read JPEG Files #284

homestar9 opened this issue Jan 16, 2024 · 5 comments

Comments

@homestar9
Copy link

Hello,
I am working on building a CFML wrapper for your awesome library so the ColdFusion community can use it. I added the following JARs to my application's classPath:

scrimage-core-4.1.1.jar
scrimage-webp-4.1.1.jar

However, when I attempt to read a JPEG image, I get the following error:
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:

My code looks like this:

// Get a new instance of the immutable image object (com.sksamuel.scrimage.ImmutableImage)
var immutableImage = scrimage.getImmutableImage();

// Create a new instance of a java file object pointing to a sample jpg file
var imgFile = createObject("java", "java.io.File").init( "D:\temp\test.jpg" );

// read the java file object
var myImage = immutableImage.loader().fromFile( imgFile );

Do you have any idea of what I might be missing?

@sksamuel
Copy link
Owner

Sounds like the scrimage-webp maven module is not being picked up from the classpath that coldfusion uses.

@homestar9
Copy link
Author

Strange. I do see scrimage-webp.jar listed in all of the jars loaded. I wonder if it could have something to do with the JVM version used by Adobe ColdFusion. Thanks for taking the time to reply by the way. :)

@dimitriz09
Copy link

Hello, i do have a very similar problem.
While it works well running locally on my PC, on my preprod env i have this error.

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@301c39b1 failed due to java.io.IOExceptio

I use docker to run a jar file on a VPS. When inspecting the jar deployed (built with command gradle buildFatJar) i can see that the file com/sksamuel/scrimage/webp/WebpImageReader.class is indeed in the jar file so i don't really understand the error.

@aaa1115910
Copy link

aaa1115910 commented May 6, 2024

I also encountered the same problem. When I package the jar and then run it, the problem will occur.

image

update: It seems that an exception will be thrown when reading any image.... not only jpg....

Solution found in #245

@sksamuel
Copy link
Owner

sksamuel commented Jun 3, 2024

Solution in #245

@sksamuel sksamuel closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants