batch apply curve on a copy of visible with given opacity, export JPEG

Usage:

$ gimp -d -f -i -b "(begin $defcurves (satsvis-curves $opacity \"*.[jJ][pP][gG]\"))" -b '(gimp-quit 0)'

where 0<opacity<100, read a gimp curve file into $defcurves with e.g.

defcurves=$(< ~/.gimp-2.8/curves/KodakPortra awk  '
    BEGIN{
        print "(define (my-curves)\n  (quote ("
    }
    /^[0-9 -]+$/{print "    ("$0")"} # simple curve file format
    /^ *\(points [0-9 .-]+\) *$/ {   # GIMP curve settings format
        printf "    ("
        for(i=3;i<=NF;i++) {
            sub(/\)/,"",$i)
            if($i ~ /^-/) printf "" # "-1 "
            else printf "%d ", $i*255
        }
        print ")"
    }
    END{print ")))"}')