(sorry if this appears twice, I only just subscribed) Kevin Payne <paynekj hotmail com> writes:
A couple of years ago I wrote a script-fu script to read curve files if that helps: http://www.gimptalk.com/index.php?/topic/50107-batch-edit-curves/
This works for the exports from GIMP, but GIMP also reads a more compact
curve file format, that looks e.g. like this:
# GIMP Curves File
0 22 74 53 121 133 181 197 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 255 255
31 35 105 107 188 192 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 255 246
17 1 62 62 126 134 196 202 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 255 255
26 40 66 63 128 137 198 208 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 255 255
0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 255 255
The whole file is those 6 lines, which as far as I can test corresponds
to the following six curves:
HISTOGRAM-VALUE #(0 22 74 53 121 133 181 197 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 255 255)
HISTOGRAM-RED #(31 35 105 107 188 192 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 255 246)
HISTOGRAM-GREEN #(17 1 62 62 126 134 196 202 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 255 255)
HISTOGRAM-BLUE #(26 40 66 63 128 137 198 208 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 255 255)
HISTOGRAM-ALPHA #(0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 255 255)
The curves I've downloaded from the web tend to have this format. Should
be even easier to parse though.
For my own purposes I've so far just used a stupid awk script that puts
curves into a list of lists:
awk '
BEGIN{ print "(" }
/^[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 ")"}'
--
Kevin Brubeck Unhammer
GPG: 0x766AC60C
Attachment:
pgprgELT_w3mE.pgp
Description: PGP signature