]> git.scottworley.com Git - picsort/blame_incremental - pics-preprocess
Use the local rename-to-date
[picsort] / pics-preprocess
... / ...
CommitLineData
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
7MINFREESPACE=$((10 * 1024 * 1024)) # 10GiB in KiB
8
9SMALLHEIGHT=700
10
11renice -n 19 $$
12ionice -c 3 -p $$
13
14for f;do
15 if (( "$(df -k . | awk 'NR == 2 { print $4 }')" < $MINFREESPACE ));then
16 echo "Out of disk space"
17 break
18 fi
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"
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
28 pics-run-ufraw "$exposure" "$f" "$out"
29 fi
30 if [[ -s "sm/$out" ]];then
31 echo "Skipping sm/$out"
32 else
33 convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out"
34 fi
35 done
36 else
37 if [[ -s "sm/$f" ]];then
38 echo "Skipping sm/$f"
39 else
40 mkdir -p sm
41 convert "$f" -geometry "x$SMALLHEIGHT" "sm/$f"
42 fi
43 fi
44done