Replies: 2 comments 1 reply
-
I can see where confusion lies... Here's the description for
Really it should be something like this:
So essentially, it's finding the dimension with the smallest delta and scaling using that as the starting point.
Given that this is the only library that offers precalculated options such as I would disagree that this requirement should be something already existing. Max is the closest and I don't think it's unreasonable for consumers to sanitize their input prior to calling this library functions. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick answer, your awesome. I'm was trying to shrink a folder of images down to less than a reasonable size by reducing dimensions and applying compression. This was enough to make Max do what I want and prevent upscaling. Helper
Usage
|
Beta Was this translation helpful? Give feedback.
-
We have a content management system with a specific container size.
Some images are wide and some are tall.
We would like to resize the photo to reduce size as far as need to fit inside the container.
Height and width both and do not upscale.
From my testing:
ResizeMode.Min
does not shrink the image enough in one direction.ResizeMode.Max
will upscale smaller images.I have written a test showing how ResizeMode.Min does not reduce the image enough
Result: Assert.Equal() Failure: Values differ
Expected: 1080
Actual: 1440
Am I missing something here as this seems like it would be a common use case of reduce an image proportionally in either direction so long as it's smaller than the destination in both direction and don't upscale.
I believe Max would work for me if it did not upscale.
I'm sure I can add something to only resize if photo is larger in one of the two direction to prevent upscale but wanted to check I wasn't missing something since it seems like it would be a common use case.
Beta Was this translation helpful? Give feedback.
All reactions