Functions min_jpg and min_png work on multiple files

main
Buddy Sandidge 2 years ago
parent 7c02ea153d
commit a6d113956c

@ -95,19 +95,25 @@ command_installed() (
min_jpg() (
set -ue
command_installed jpegtran
file=$1
out_file=$(mktemp)
jpegtran -optimize -perfect -outfile "$out_file" "$file"
mv "$out_file" "$file"
for FILE in "$@" ; do
PERMISSIONS=$(stat --format '%a' "${FILE}")
OUT_FILE=$(mktemp)
jpegtran -optimize -perfect -outfile "${OUT_FILE}" "${FILE}"
mv "${OUT_FILE}" "${FILE}"
chmod "${PERMISSIONS}" "${FILE}"
done
)
min_png() (
set -ue
command_installed pngcrush
out_file=$(mktemp)
file=$1
pngcrush -rem alla -reduce -brute "$file" "$out_file"
mv "$out_file" "$file"
for FILE in "$@" ; do
PERMISSIONS=$(stat --format '%a' "${FILE}")
OUT_FILE=$(mktemp)
pngcrush -rem alla -reduce -brute "${FILE}" "${OUT_FILE}"
mv "${OUT_FILE}" "${FILE}"
chmod "${PERMISSIONS}" "${FILE}"
done
)
get_create_date() (

Loading…
Cancel
Save