Browse Source

Added image optimization script to bash manager.

pull/11/head
jrtechs 6 years ago
parent
commit
05a10e5f90
2 changed files with 18 additions and 0 deletions
  1. +17
    -0
      scripts/optimizeImages.sh
  2. +1
    -0
      src/.zshrc

+ 17
- 0
scripts/optimizeImages.sh View File

@ -0,0 +1,17 @@
#!/bin/bash
# Simple script for optimizing all images for a website
#
# @author Jeffery Russell 7-19-18
WIDTH="690>" # the ">" tag specifies that images will not get scaled up
for f in $(find "./" -name '*.jpg' -or -name '*.JPG'); do
convert "$f" -resize $WIDTH "$f"
jpegoptim --max=80 --strip-all --preserve --totals --all-progressive "$f"
done
for f in $(find "./" -name '*.png' -or -name '*.PNG'); do
convert "$f" -resize $WIDTH "$f"
optipng -o7 -preserve "$f"
done

+ 1
- 0
src/.zshrc View File

@ -89,6 +89,7 @@ alias ss="python3 /home/jeff/scripts/bash_manager/src/ssh_manager.py"
alias ssh_manager="python3 /home/jeff/scripts/bash_manager/src/ssh_manager.py"
alias quote="python3 /home/jeff/scripts/bash_manager/src/quote.py"
alias ls="ls -abp --color=auto"
alias imgo="sh /home/jeff/scripts/bash_manager/scripts/optimizeImages.sh"
function cd {
builtin cd "$@" && ls

Loading…
Cancel
Save