Skip to content

Instantly share code, notes, and snippets.

@hgwr
Created August 4, 2019 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hgwr/9f7581c51a6f3c334a82ba0af258fc90 to your computer and use it in GitHub Desktop.
Save hgwr/9f7581c51a6f3c334a82ba0af258fc90 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
outdir=$1
if [ "$outdir" == "" ]; then
outdir=../out/
fi
mkdir -p "$outdir"
for i in $( ls *.jpg ); do
echo "$i"
# convert "$i" -level 1%,99%,1.0 -type GrayScale -geometry 1200x -compress jpeg -quality 85 "$outdir/$i"
convert "$i" -level 20%,80%,1.0 -type GrayScale -geometry 1200x -compress jpeg -quality 85 "$outdir/$i"
# convert "$i" -level 10%,90%,1.0 -type GrayScale -geometry 1200x -compress jpeg -quality 85 "$outdir/$i"
# convert "$i" -level 30%,70%,1.0 -type GrayScale -geometry 1200x -compress jpeg -quality 85 "$outdir/$i"
# convert "$i" -threshold 55000 -depth 4 -geometry 758x1024 -compress jpeg -quality 85 "$outdir/$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment