You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
631 B
Bash
31 lines
631 B
Bash
4 years ago
|
#!/usr/bin/env bash
|
||
4 years ago
|
#ft=bash
|
||
12 years ago
|
|
||
|
function min-jpg {
|
||
4 years ago
|
if ! command -v jpegtran &> /dev/null ; then
|
||
|
echo "jpegtran not installed"
|
||
|
fi
|
||
6 years ago
|
tmpfile="$(mktemp)"
|
||
12 years ago
|
ogfile="$1"
|
||
6 years ago
|
jpegtran -optimize -perfect -outfile "$tmpfile" "$ogfile"
|
||
4 years ago
|
mv "$tmpfile" "$ogfile"
|
||
12 years ago
|
}
|
||
|
|
||
|
function min-png {
|
||
4 years ago
|
if ! command -v pngcrush &> /dev/null ; then
|
||
|
echo "pngcrush not installed"
|
||
|
fi
|
||
6 years ago
|
tmpfile="$(mktemp)"
|
||
12 years ago
|
ogfile="$1"
|
||
6 years ago
|
pngcrush -rem alla -reduce -brute "$ogfile" "$tmpfile"
|
||
|
mv "$tmpfile" "$ogfile"
|
||
12 years ago
|
}
|
||
|
|
||
|
function get-create-date {
|
||
6 years ago
|
date -r "$1" +"%F"
|
||
12 years ago
|
}
|
||
|
|
||
|
function add-date-prefix {
|
||
4 years ago
|
add_date_prefix "$1" "$2"
|
||
12 years ago
|
}
|