]> git.scottworley.com Git - picsort/blob - pics-preprocess
55b27179d99ba1d8eede4b7565557662d67337c7
[picsort] / pics-preprocess
1 #!/usr/bin/env 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 SMALLHEIGHT=700
8
9 renice -n 19 $$
10
11 for f;do
12 if [[ "$f" == *.NEF ]];then
13 for level in {10..30};do
14 mkdir -p {,sm/}"$level"
15 base="$(basename "$f")"
16 out="$level/${base%.NEF}.jpeg"
17 if [[ -s "$out" ]];then
18 echo "Skipping $out"
19 else
20 exposure=$(dc <<< "2k $level 4 / 3.5-p") # 10 to 30 -> -1 to 4 in .25 steps
21 pics-run-ufraw "$exposure" "$f" "$out"
22 fi
23 if [[ -s "sm/$out" ]];then
24 echo "Skipping sm/$out"
25 else
26 convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
27 fi
28 done
29 else
30 if [[ -s "sm/$f" ]];then
31 echo "Skipping sm/$f"
32 else
33 mkdir -p sm
34 convert "$f" -geometry "x$SMALLHEIGHT" "sm/$f"
35 fi
36 fi
37 done