Closed emmtte closed 7 years ago
Just add the --max flag, that should do exactly what you want.
On Wednesday, May 11, 2016, Emmanuel CHARETTE notifications@github.com wrote:
Hi, I need to resize an image with 2048px maximum hight or 2048px maximum width. How to do this with command line?
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/vseventer/sharp-cli/issues/1
Mark
Ok thanks it's working
Hi, with new version --max flag not working anymore
@ManuCart What's the exact command you are using? This should still work as expected.
Before I used
sharp --verbose --max --width 2048 --height 2048 --withoutEnlargement -o "$FILE" "$FILE"
But now I have problems with width and height and output files.
Why so many changes?
Your new command should be:
sharp -i $FILE -o $OUTFILE resize 2048 2048 --max --withoutEnlargement
, or
cat $FILE | sharp resize 2048 2048 --max --withoutEnlargement > $OUTFILE
.
You can still use the old version of the CLI by installing 0.7.0, but I recommend updating to the latest version. This latest version is up to date with the full sharp API, is more stable, and takes the order of operations into account (e.g. resize then rotate is different from rotate then resize).
OK, thanks for your help
A note to future readers: --max
has been removed in version 1.8.0. You can achieve the same now with --fit inside
(also in combination with --withoutEnlargement
).
Hi, I need to resize an image with 2048px maximum hight or 2048px maximum width. How to do this with command line?