Skip to content

Conversation

@jayme-github
Copy link
Contributor

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

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.
@jayme-github
Copy link
Contributor Author

jayme-github commented Nov 2, 2017

Just discovered that this change does not fix all edge cases. Input of []int{412, 3460} still breaks the bounds:

image_test.go:150: Invalid image size: 421x316

factor = math.Min(xfactor, yfactor)
} else {
factor = math.Max(xfactor, yfactor)
}
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests were breaking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, TestResizeVerticalImage fails with #198.
We see some shrinking issues introduced with #198, currently still under investigation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greut please see #205

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

Successfully merging this pull request may close these issues.

3 participants