File: compareRT

package info (click to toggle)
rawtherapee 5.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 124,328 kB
  • sloc: cpp: 271,715; ansic: 27,904; sh: 1,109; python: 521; cs: 155; xml: 57; makefile: 15
file content (59 lines) | stat: -rwxr-xr-x 1,912 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
#
# compareRT version 1.0, 2014-01-24
# compareRT version 1.1, 2015-02-24
# Processes all images in the current dir with two different
# RawTherapee versions and tests for differences.
#
# Run this script from the dir with the images you want to test.
# Make sure the PP3 you set below is in the same dir.
# Don't worry about non-image files.
# Each dir specified in rtDirs and the outDir must end with /
#
# CC-BY-SA 3.0 DrSlony

unset rtDirs outDir pp3 imgs v i c

#--- Edit these as needed.
rtDirs=("$HOME/rt_default_release/" "$HOME/rt_default_release_patched/")
pp3="foo.pp3"
outDir="/tmp/compareRT/"
#---

while IFS=$'\n' read f; do
    imgs+=("$f")
done < <(find . -maxdepth 1 -type f -not -iname "*.txt" -not -iname "*.pp3" | sed "s_./__" | sort)

abort () {
    printf "%s\n" "" "Aborted"
    exit 1
}
trap 'abort' HUP INT QUIT ABRT TERM

mkdir -p "$outDir" || exit 1

i=0
for rtDir in "${rtDirs[@]}"; do
    c=1
    pp3name=${pp3%.*}
    pp3name=${pp3name#*/}
    v+=("$(grep "Commit:.*" "${rtDir}/AboutThisBuild.txt" | sed "s/Commit: //")")
    printf "%s\n" "Developing images using RawTherapee commit ${v[$i]} - ${rtDir}"
    for img in "${imgs[@]}"; do
        printf "%s" "${c}/${#imgs[@]} - "
        "${rtDir}rawtherapee" -o "${outDir}${img%.*}_${v[i]}_${pp3%.*}.tif" -p "${pp3}" -t -Y -c "$img" | grep Processing
        ((c++))
    done
    ((i++))
    echo
done
printf "%s\n" "Comparing images"
hash compare 2>/dev/null || { printf "%s\n" "\"compare\" not found." "Install imagemagick (or graphicsmagick if it has \"compare\"), then re-run this script."; exit 1; }
n=1
for img in "${imgs[@]}"; do
    printf "%s\n" "${n}/${c} - ${img}"
    compare -quiet "${outDir}${img%.*}_${v[0]}_${pp3%.*}.tif" "${outDir}${img%.*}_${v[1]}_${pp3%.*}.tif" "${outDir}${img%.*}_compare.tif"
    ((n++))
done

printf "%s\n" "" "${v[0]} is ${rtDirs[0]}" "${v[1]} is ${rtDirs[1]}" "Finished"