]> git.scottworley.com Git - picsort/blame - pics-preprocess
Reduce jank
[picsort] / pics-preprocess
CommitLineData
e18c13a6
SW
1#!/bin/bash
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
SW
6
7GREEN=1.105
8TEMPERATURE=5500
9JPEGCOMPRESSION=95
9952a1a7 10SMALLHEIGHT=700
e18c13a6
SW
11
12
13for f;do
cd368e97
SW
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"
fd69f569 36 fi
cd368e97 37 fi
e18c13a6 38done