]> git.scottworley.com Git - picsort/blame - pics-preprocess
Use the local rename-to-date
[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
95201e91
SW
7MINFREESPACE=$((10 * 1024 * 1024)) # 10GiB in KiB
8
9952a1a7 9SMALLHEIGHT=700
e18c13a6 10
47aee54b 11renice -n 19 $$
f5b65ffb 12ionice -c 3 -p $$
e18c13a6
SW
13
14for f;do
95201e91
SW
15 if (( "$(df -k . | awk 'NR == 2 { print $4 }')" < $MINFREESPACE ));then
16 echo "Out of disk space"
17 break
18 fi
cd368e97
SW
19 if [[ "$f" == *.NEF ]];then
20 for level in {10..30};do
21 mkdir -p {,sm/}"$level"
22 base="$(basename "$f")"
23 out="$level/${base%.NEF}.jpeg"
1365c024
SW
24 if [[ -s "$out" ]];then
25 echo "Skipping $out"
26 else
27 exposure=$(dc <<< "2k $level 4 / 3.5-p") # 10 to 30 -> -1 to 4 in .25 steps
7e0b085a 28 pics-run-ufraw "$exposure" "$f" "$out"
cd368e97 29 fi
1365c024
SW
30 if [[ -s "sm/$out" ]];then
31 echo "Skipping sm/$out"
32 else
cd368e97
SW
33 convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
34 fi
35 done
36 else
1365c024
SW
37 if [[ -s "sm/$f" ]];then
38 echo "Skipping sm/$f"
39 else
bb17aed5 40 mkdir -p sm
cd368e97 41 convert "$f" -geometry "x$SMALLHEIGHT" "sm/$f"
fd69f569 42 fi
cd368e97 43 fi
e18c13a6 44done