-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
no resize when source image's width equals target image's width #65
Comments
Jim, This was done intentionally; can you describe your scenario and what the expected or preferred behavior would have been for you? |
For example:source image:width=200 height=100,target image:width=200 height=50,the condition will be true,so there is no resize will happen. |
oh forget the parameter Scalr.Mode.FIT_EXACT |
Jim, imgscalr is behaving as-designed, more information here: #63 As you found out, using the different Mode values can change the short-circuiting behavior. I will close this issue for the same reason I closed Issue #64, but please let me know if you'd like to discuss this further or disagree with my reasoning and I will be happy to re-open it. |
there is an introduction on the website I always use the Mode.FIT_EXACT,but it doesn't work in the situation I mentioned above.I just comment the condition ant it works,but don't kown if there is any side effect. |
Jim I will take a look and see if I have bug in there; thank you for clarifying. Re-opening issue. |
Jim, Great catch; I did have a bug in there when FIT_EXACT is used, it should be an && condition and not a || condition on line 2267. This will be fixed in the 4.2 release. |
added test-case to catch it in the future. The stop-condition in incremental scaling (line 2266) was stopping too early if either the width OR height didn't change between an incremental scale. Technically the incremental scaling shouldn't stop until BOTH dimensions stop changing. The fix was simple; change the check from || to &&.
I should thank you,it's a great library.Thank you again. |
no resize when source image's width equals target image's width.
the condition in the method scaleImageIncrementally
if (prevCurrentWidth == currentWidth
|| prevCurrentHeight == currentHeight)
break;
is true,so break out;
no resize when source image's height equals target image's height.
The text was updated successfully, but these errors were encountered: