vseventer / sharp-cli

CLI for sharp.
MIT License
189 stars 20 forks source link

Question #1

Closed emmtte closed 7 years ago

emmtte commented 8 years ago

Hi, I need to resize an image with 2048px maximum hight or 2048px maximum width. How to do this with command line?

vseventer commented 8 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

emmtte commented 8 years ago

Ok thanks it's working

emmtte commented 7 years ago

Hi, with new version --max flag not working anymore

vseventer commented 7 years ago

@ManuCart What's the exact command you are using? This should still work as expected.

emmtte commented 7 years ago

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?

vseventer commented 7 years ago

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).

emmtte commented 7 years ago

OK, thanks for your help

KasparEtter commented 4 years ago

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).