convert RGB image to grayscale

convert is a very powerful tool from the ImageMagick toolbox.

Here is how you can use it to convert an image to grayscale:

convert infile.png -channel RGBA -matte -colorspace gray outfile.png

This is especially handy in case you want to create a bitmap mask for use with iOS SDK. Indeed, you can create your mask in Photoshop (or whatever other image processing program you like) as a B&W image but without any concern for the actual format and  then the above conversion will ensure that the final image has the correct format.

Copyright © Labs Ramblings

Built on Notes Blog by TDH
Powered by WordPress

That's it - back to the top of page!