]> git.scottworley.com Git - picsort/blob - pics-preprocess
'r' to Rotate.
[picsort] / pics-preprocess
1 #!/bin/bash
2
3 # Pass .NEF and .jpeg files as $@.
4 # This makes many variants of each .NEF file at different exposure levels
5 # and makes reduced-size versions for faster browsing.
6
7 GREEN=1.105
8 TEMPERATURE=5500
9 JPEGCOMPRESSION=95
10 SMALLHEIGHT=700
11
12
13 for f;do
14 if [[ "$f" == *.NEF ]];then
15 for level in {10..30};do
16 mkdir -p {,sm/}"$level"
17 base="$(basename "$f")"
18 out="$level/${base%.NEF}.jpeg"
19 exposure=$(dc <<< "2k $level 4 / 3.5-p") # 10 to 30 -> -1 to 4 in .25 steps
20 if [[ ! -s "$out" ]];then
21 ufraw-batch --out-type=jpeg \
22 --green="$GREEN" \
23 --temperature="$TEMPERATURE" \
24 --compression="$JPEGCOMPRESSION" \
25 --exposure="$exposure" \
26 --output="$out" \
27 "$f"
28 fi
29 if [[ ! -s "sm/$out" ]];then
30 convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
31 fi
32 done
33 else
34 if [[ ! -s "sm/$f" ]];then
35 convert "$f" -geometry "x$SMALLHEIGHT" "sm/$f"
36 fi
37 fi
38 done