summaryrefslogtreecommitdiff
path: root/iencode.sh
blob: 990d027878e242ca6a991ec9b8eb0b0f0b9e7ce2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# configure cwebp location if not in PATH
CWEBP=cwebp
# configure flags
CWEBP_FLAGS="-m 6"

cd $(dirname $0)/www/dump

iencode() {
  EXT="$1"
  QUAL="$2"
  export EXT QUAL CWEBP CWEBP_FLAGS
  set -x
  find . -name \*."${EXT}" -print0 | xargs -0 -P ${THREADS} -n 1 bash -c '
    IN="$0"
    OUT="${IN%.${EXT}}.webp"
    ${CWEBP} -q "${QUAL}" ${CWEBP_FLAGS} ${IN} -o ${OUT}
  '
}

iencode jpg 90
iencode png 99