Code: Select all
convert file1.jpg -function Polynomial $gain,$bias out.jpg
Code: Select all
convert file1.jpg -function Polynomial $gain,$bias out.jpg
snibgo wrote:Shells are often bad at handling floating-point. Either use a calculator like bc, or do more calculation within IM, eg:This returns 1 when the mean is greater than 0.345; otherwise it returns 0.Code: Select all
identify -format "%[fx:mean>0.345?1:0]\n" filename
You may need to escape the ">".
Code: Select all
exiftool -Composite:PreviewImage -b myfile.dng >preview.jpg
Code: Select all
exiftool -b -PreviewImage -w _preview.jpg -ext dng .
Code: Select all
f:\web\im>%IM%convert cons3.jpg -gravity North -crop x50%+0+0 +repage -colorspace HCL -format %[fx:mean.g] info:
0.254661
f:\web\im>%IM%convert cons4.jpg -gravity North -crop x50%+0+0 +repage -colorspace HCL -format %[fx:mean.g] info:
0.0418506
Code: Select all
f:\web\im>%IM%convert cons3.jpg -gravity South -crop x50%+0+0 +repage -auto-gamma -format %[fx:standard_deviation] info:
0.146643
f:\web\im>%IM%convert cons4.jpg -gravity South -crop x50%+0+0 +repage -auto-gamma -format %[fx:standard_deviation] info:
0.0988983
Code: Select all
f:\web\im>%IM%convert cons3.jpg -gravity South -crop x50%+0+0 +repage -auto-gamma -format %[fx:mean.r/mean.b] info:
1.17196
f:\web\im>%IM%convert cons4.jpg -gravity South -crop x50%+0+0 +repage -auto-gamma -format %[fx:mean.r/mean.b] info:
1.00884
Code: Select all
chroma=$(convert "$file" -gravity North -crop x50%+0+0 +repage -colorspace HCL -format %[fx:mean.g] info:)
In unix, the %[...] needs to be quoted. Trychroma=$(convert "$file" -gravity North -crop x50%+0+0 +repage -colorspace HCL -format %[fx:mean.g] info:)
Code: Select all
chroma=$(convert "$file" -gravity North -crop x50%+0+0 +repage -colorspace HCL -format "%[fx:mean.g]" info:)
Code: Select all
refchroma=$(convert "$refimg" -gravity North -crop x50%+0+0 +repage -colorspace HCL -format "%[fx:mean.g]" info:)
chroma=$(convert "$file" -gravity North -crop x50%+0+0 +repage -colorspace HCL -format "%[fx:mean.g]" info:)
Code: Select all
refchroma=$(convert "$refimg" -gravity North -crop x50%+0+0 +repage -colorspace HCL -format "%[fx:mean.g]" info:)
diff=$(convert "$file" -gravity North -crop x50%+0+0 +repage -colorspace HCL -format "%[fx:$refchroma-mean.g]" info:)
trydiff=$(bc -l<< "$refchroma-$chroma"),
Code: Select all
diff=$(echo "scale=6; ($refchroma-$chroma)/1" | bc)
Code: Select all
diff=$(convert xc: -format "%[fx:$refchroma-$chroma]" info:)