Last Updated: February 25, 2016
·
4.968K
· jameshuynh

Image Magick to change image color

Use this command to change all the images with extension png to any color that you want to (currently it is #ccccccc). I found those especially helpful when I need to do batch conversion or when I am lazy to turn on my photoshop or pixel mator

for filename in *.png; do file=`echo "$filename"`;convert $filename -fuzz 100% -fill '#cccccc' -opaque white $file;done   

You also can resize the photo

for filename in *.png; do file=`echo "$filename"`;convert $filename -fuzz 100% -fill '#cccccc' -resize 24x24 -opaque white $file;done   

You also can invert the photo's color

for filename in *.png; do file=`echo "$filename"`;convert $filename -negate $filename;done

Or you can do with one single image:

convert cancel.png -negate cancel_invert.png