-
Notifications
You must be signed in to change notification settings - Fork 341
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
Fix Image.Enlarge keep image size in boundaries #204
base: master
Are you sure you want to change the base?
Conversation
Image.Enlarge does not always return an image that fits into the given width and height boundaries. To fix that, imageCalculations() now returns the maximum factor instead if the minimum if no cropping is requested and the desired image is bigger than the source.
Just discovered that this change does not fix all edge cases. Input of
|
factor = math.Min(xfactor, yfactor) | ||
} else { | ||
factor = math.Max(xfactor, yfactor) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi. this is a revert from #198 with an additional check. Might be better, indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint. Wat was the reason for removing the check in first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests were breaking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Image.Enlarge does not always return an image that fits into the given
width and height boundaries.
To fix that, imageCalculations() now returns the maximum factor instead
if the minimum if no cropping is requested and the desired image is
bigger than the source.
Im not completely sure with this but I expected
Image.Enlarge
to always return images that don't exceed the width and height provided./cc @tback