webify 448 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. set -eu
  3. if (( $# == 0 )); then
  4. cat <<HELP
  5. Usage: $(basename "$0") inputfile outputfile
  6. creates outputfile
  7. HELP
  8. exit 1
  9. fi
  10. haz?() {
  11. command -v "$1" > /dev/null 2>&1
  12. }
  13. haz? gm && convert_cmd="gm convert"
  14. haz? convert && convert_cmd="convert"
  15. infile="$1"
  16. outfile="$2"
  17. $convert_cmd "$infile" -resize "1280x" -unsharp 2x0.5+0.7+0 -quality 98 -sigmoidal-contrast 3,50% "$outfile"
  18. jpegtran "$outfile" | sponge "$outfile"