Skip to content
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" option not working correctly #11

Closed
ezekg opened this issue Jan 22, 2018 · 3 comments
Closed

Resize "withoutEnlargement" option not working correctly #11

ezekg opened this issue Jan 22, 2018 · 3 comments

Comments

@ezekg
Copy link

ezekg commented Jan 22, 2018

I'm trying to resize a directory of png images, but some of the images are already below my specified width/height, resulting in them being either cropped (if --max isn't provided) or scaled up.

For example,

sharp -i src/images/*.png -o dist/images resize 640 640 --withoutEnlargement --max -- --quality 90 --optimize

results in all images being scaled up to 640, regardless of whether or not some of the images are already smaller than 640, even though I specified the --withoutEnlargement flag.

Any ideas?

@ezekg
Copy link
Author

ezekg commented Jan 22, 2018

It looks like this line never applies sharp.withoutEnlargement() when the option is enabled. Sharp's default behavior is to not apply that option. Maybe that's where the issue is stemming from?

@vseventer
Copy link
Owner

vseventer commented Jan 29, 2018

@ezekg I misinterpreted sharp's documentation stating withoutEnlargement defaults to true - this only holds if the flag is actually present.

@ezekg
Copy link
Author

ezekg commented Jan 29, 2018

No problem! Thanks for the quick fix. 🙂

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

No branches or pull requests

2 participants