-
Notifications
You must be signed in to change notification settings - Fork 172
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
Automatic cropping doesn't always respect scale=down #12
Comments
When &scale=down, upscaling should never occur. Instead, the image should only be cropped sufficiently to meet the size restrictions, not to meet the aspect ratio. Example: Source image of 300x400
|
Clarification for example 2, result 2: image should be cropped to 300x300, then padded with transparency to be 400x300. |
I've added some DiagnosticJson regression tests for the above 3 cases, but I had to guess at the right numbers for the desired behavior. The current (master) code results in the following (the actual page has colors, which makes this easier to see):
Note that the BAD behavior is current passing, and the GOOD behavior is failing. (The third case @nathanaeljones listed had the current and correct values the same; I don't know if the current behavior is actually correct, or if there is a slight internal difference we should be looking for.) The fourth case ("manual/auto crop") comes from the comment in the pull request (issue #37), which would appear to already be passing. @nathanaeljones, if you have a further set of commands/expectations in mind, I can add those as well; otherwise, I'll have to explore a bit to see what commands look like they might interact with autocrop and what values are interesting. |
The current behavior is correct when scale=both is specified - the bug is for scale=down and scale=canvas being ignored. |
Cool. I can flatten/merge the third regression case down to the One True Correct behavior. Would you like me to go ahead and merge the pull request, review and test it, and commit/push if it looks good? |
Yes, let's go ahead and merge it. |
…eated/set until they're needed).
Bug in ImageBuilder.cs LayoutImage method:
Automatic cropping can bypass the scale=down checks in certain scenarios, such as when the requested and original aspect ratio differ significantly, and the uncropped (but resized) image would normally not cause upscaling.
Solving this without breaking things will require unit tests.
The text was updated successfully, but these errors were encountered: