-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
resize: withoutEnlargement: Height disregarded when cover && width > original width #2020
Comments
At the surface it looks as if this here is the culprit: Lines 226 to 237 in 755a0ca
Might changing that to something like this instead do the trick?
|
Hi Brychan, this is a nice bug, rather amazing it took this long for someone to find so thank you for reporting it! I think the proposal above might impact the aspect ratio; the following alternative could also work: - if (baton->withoutEnlargement) {
+ if (baton->withoutEnlargement && baton->width > inputWidth && baton->height > inputHeight) { Happy to accept a PR with a fix and your example scenario as a new test case to prevent this occurring again, if you're able. |
v0.24.0 is now available. Thanks for both reporting and fixing this! |
What are the steps to reproduce?
Take an image of dimensions 1500 x 1000.
What is the expected behaviour?
An image of 1500 x 250.
Instead we get an image of 1500 x 1000.
Example code:
https://github.com/BrychanOdlum/Sharp-BugExample/blob/master/main.js
https://github.com/BrychanOdlum/Sharp-BugExample (has input & output image in repo)
What is the output of running
npx envinfo --binaries --languages --system --utilities
?System:
OS: macOS 10.15
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 232.27 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.11.0 - ~/.nvm/versions/node/v12.11.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.3 - ~/.nvm/versions/node/v12.11.0/bin/npm
Utilities:
CMake: 3.15.4 - /usr/local/bin/cmake
Make: 3.81 - /usr/bin/make
GCC: 4.2.1 - /usr/bin/gcc
Git: 2.21.0 - /usr/bin/git
Clang: 1100.0.33.8 - /usr/bin/clang
Subversion: 1.12.2 - /usr/local/bin/svn
Languages:
Bash: 3.2.57 - /bin/bash
Go: 1.12.6 - /usr/local/go/bin/go
Java: 1.8.0_161 - /usr/bin/javac
Perl: 5.30.0 - /usr/local/bin/perl
PHP: 7.3.8 - /usr/bin/php
Python: 2.7.16 - /usr/local/bin/python
Python3: 3.7.5 - /usr/local/bin/python3
Ruby: 2.6.3 - /usr/bin/ruby
The text was updated successfully, but these errors were encountered: