]> git.scottworley.com Git - picsort/blame - pics-preprocess
Find bash with env
[picsort] / pics-preprocess
CommitLineData
967baf16 1#!/usr/bin/env bash
e18c13a6 2
cd368e97
SW
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.
e18c13a6 6
9952a1a7 7SMALLHEIGHT=700
e18c13a6 8
47aee54b 9renice -n 19 $$
e18c13a6
SW
10
11for f;do
cd368e97
SW
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"
1365c024
SW
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
7e0b085a 21 pics-run-ufraw "$exposure" "$f" "$out"
cd368e97 22 fi
1365c024
SW
23 if [[ -s "sm/$out" ]];then
24 echo "Skipping sm/$out"
25 else
cd368e97
SW
26 convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
27 fi
28 done
29 else
1365c024
SW
30 if [[ -s "sm/$f" ]];then
31 echo "Skipping sm/$f"
32 else
bb17aed5 33 mkdir -p sm
cd368e97 34 convert "$f" -geometry "x$SMALLHEIGHT" "sm/$f"
fd69f569 35 fi
cd368e97 36 fi
e18c13a6 37done