diff --git a/scripts/optimizeImages.sh b/scripts/optimizeImages.sh new file mode 100755 index 0000000..9f84397 --- /dev/null +++ b/scripts/optimizeImages.sh @@ -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 \ No newline at end of file diff --git a/src/.zshrc b/src/.zshrc index 07932a1..89d7809 100644 --- a/src/.zshrc +++ b/src/.zshrc @@ -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