diff --git a/tools/compareRT b/tools/compareRT index 05f5652cf..cca18bee6 100755 --- a/tools/compareRT +++ b/tools/compareRT @@ -1,51 +1,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. -# In order to keep this simple, all dir names must end with / +# Each dir specified in rtDirs and the outDir must end with / +# # CC-BY-SA 3.0 DrSlony -unset rtDirs outDir pp3 imgs v i +unset rtDirs outDir pp3 imgs v i c #--- Edit these as needed. -rtDirs=("$HOME/rt_default_Release/" "$HOME/rt_default_Release_patched/") +rtDirs=("$HOME/rt_default_release/" "$HOME/rt_default_release_patched/") +pp3="foo.pp3" outDir="/tmp/compareRT/" -pp3="$HOME/rawtherapee/rtdata/profiles/Default.pp3" -while IFS=$'\n' read f; do - imgs+=("$f") -done < <(find . -maxdepth 1 -type f -not -iname "*.txt" -not -iname "*.pp3" | sed "s_./__" | sort) #--- +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 + printf "%s\n" "" "Aborted" + exit 1 } trap 'abort' HUP INT QUIT ABRT TERM mkdir -p "$outDir" || exit 1 i=0 -for rt in "${rtDirs[@]}"; do - c=1 - v+=("$(grep "Changeset:.*" "${rt}/AboutThisBuild.txt" | sed "s/Changeset: //")") - printf "%s\n" "Developing images using RawTherapee changeset ${v[$i]}" - for img in "${imgs[@]}"; do - printf "%s" "${c}/${#imgs[@]} - " - "${rt}rawtherapee" -o "${outDir}${img%.*}_${v[$i]}.tif" -p "${pp3}" -t -Y -c "$img" | grep Processing - ((c++)) - done - ((i++)) - echo +for rtDir in "${rtDirs[@]}"; do + c=1 + pp3name=${pp3%.*} + pp3name=${pp3name#*/} + v+=("$(grep "Changeset:.*" "${rtDir}/AboutThisBuild.txt" | sed "s/Changeset: //")") + printf "%s\n" "Developing images using RawTherapee changeset ${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 "${outDir}${img%.*}_${v[0]}.tif" "${outDir}${img%.*}_${v[1]}.tif" "${outDir}${img%.*}_compare.tif" - ((n++)) + 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" "Finished" +printf "%s\n" "" "${v[0]} is ${rtDirs[0]}" "${v[1]} is ${rtDirs[1]}" "Finished"