If you don't mind using GIMP in batch mode instead of ImageMagick, you can use a Script-Fu script like this:
(define (color-curves filename output-filename curve)
(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image)))
)
(gimp-curves-explicit drawable 0 256 curve)
(gimp-file-save RUN-NONINTERACTIVE image drawable output-filename output-filename)
)
)
Save it as ~/.gimp-2.8/scripts/color-curves.scm
.
Then, on the console:
gimp -i -b '(color-curves "intput.jpg" "output.jpg" #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 8 8 8 9 9 9 9 10 10 10 11 11 11 12 12 13 13 13 14 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 25 25 26 27 27 28 28 29 30 31 31 32 33 33 34 35 36 37 37 38 39 40 41 42 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 61 62 64 66 67 69 71 73 76 78 80 83 85 88 90 93 96 98 101 104 107 110 113 116 119 122 125 128 132 135 138 141 144 148 151 154 157 160 163 167 170 173 176 179 182 185 188 191 194 197 199 202 205 207 210 212 215 217 219 222 224 226 228 228 230 231 233 235 236 237 239 240 241 242 243 244 245 246 247 248 249 249 250 250 251 251 252 252 252 253 253 253 254 254 254 254 254 254 255 255 255 255 255 255))' -b '(gimp-quit 0)'
where the third argument to color-curves are the values of samples
in your color curve file multiplied by 255 and rounded. input.jpg
and output.jpg
are the input and output images (resp.).
convert
call changes the brightness like my curve in gimp:mkdir -p new; for file in *JPG *jpg; do echo $(date) $file; convert $file -level 0%,100%,2.0 new/$file; done
. But this question (apply gimp curve withconvert
) is still interesting for me.convert -density 300 -quality 100 $file -level 0%,100%,2.0 new/$file