#!/bin/bash # create a temporary dir for storing a default processing profile # and error information # # here, we want to make sure we have a suitably large output color space, # because we want to continue editing after stitching d=$(mktemp -d) t=$d/p1.arp cat < $t [Version] Version=1015 [Color Management] OutputProfile=RTv4_ACES-AP1 EOF if [ -f "$1.arp" ]; then # if the first selected file has a sidecar, we are going to use that # (except that we override the output profile, see above) cp "$1.arp" $d/p2.arp sidecar=("-p" "$d/p2.arp") else # if the first selected file has no sidecar, we create a default one sidecar=() cat <> $t [Exposure] HLRecovery=Blend [ToneCurve] Enabled=true [LensProfile] # LcMode=lfauto # LCPFile= # UseDistortion=true # UseVignette=true # UseCA=false [RAW] CAEnabled=true CA=true CAAvoidColourshift=true CAAutoIterations=2 EOF fi # process the raw files with ART-cli, adding a progress dialog # for user notification ART-cli --progress $fast "${sidecar[@]}" -p $t -Y -t -b16 -c "$@" 2>"$d/error" \ | zenity --width=500 --progress --auto-close --text="Converting to TIFF..." # a non-zero exit status means the user cancelled the operation if [ $? -ne 0 ]; then # if so, we just exit gracefully exit 0 fi # check if there was an error err= if [ -f "$d/error" ]; then err=$(cat "$d/error") fi # remove the temporary dir rm -rf $d if [ "$err" != "" ]; then # show the error message if something went wrong zenity --error --text="$err" else # otherwise, prepare the list of arguments to provide to hugin. # Note: we are using bash arrays here to be robust wrt. file names # with spaces and/or other funny characters i=0 for fn in "$@"; do tiffs[$i]="${fn%.*}.tif" i=$(expr $i + 1) done # finally, we can run hugin hugin "${tiffs[@]}" || zenity --error --text="Something went wrong..." fi