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

the compressed image is abnormal #191

Closed
Herewell opened this issue Mar 24, 2022 · 2 comments
Closed

the compressed image is abnormal #191

Herewell opened this issue Mar 24, 2022 · 2 comments

Comments

@Herewell
Copy link

hi,
I found a problem as follows:
When I use the code below to compress the image,The compressed image is abnormal。

        Thumbnails.of(file)
                .size(640, 640)
                .keepAspectRatio(false)
                .toFile(resizeFile);

You can find the images before and after compression in the attachment。
How should i solve this problem,please help me

Environment
JDK1.8 and thumbnailator's version is 0.4.8
after:
after
before:
before

@coobird
Copy link
Owner

coobird commented Mar 24, 2022

This is a problem with Java's default JPEG reader not reading the JPEG properly.

You'll likely get better results if you use TwelveMonkey ImageIO's JPEG reader instead; you'll just need to include it as a Maven dependency and as long as it's in the classpath, that JPEG reader will be used instead of the default JPEG reader.

@Herewell
Copy link
Author

it‘s ok,thanks!

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

2 participants