-
Notifications
You must be signed in to change notification settings - Fork 789
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
Can I set max-size instead of just size? (Only scale down) #152
Comments
I've tried a |
@ILyaCyclone, unfortunately, the quick answer to your question is "no", not yet. It's been brought up in the past as well, as issue #11. I'll actually keep this ticket open, and supersede #11 with this ticket. |
Gotcha, thanks for your attention. |
This has been open for a while. |
One solution:
And then:
|
First of all, really glad to see new Thumbnailator releases in 2020 after ~6 years of silence. Cheers!
I'd like to know if there is an option to restrict upscaling of images and only resize them down.
We plan to use Thumbnailator as dynamic on-fly resizer rather than for making static thumbnails, so in rare circumstances original image may be smaller than requested size.
What happens now is that image is scaled UP to requested size and becomes very messy. I haven't found any method to tell Thumbnailator not to make images larger than they already are (even if requested size says so), only make them smaller. Is there such method?
Example:
Image original size is 150*150. For some internal reasons we call
resize(200, 200)
.I want result image to stay 150*150.
Consider this as CSS
max-width
attribute instead ofwidth
.The text was updated successfully, but these errors were encountered: