2008 09 29 converting images to grayscale in linux with imagemagick

David A Roberts edited this page Jun 9, 2015 · 1 revision

Converting images to grayscale in Linux with ImageMagick

To convert a single image 'image.jpg' to a grayscale version 'image-bw.jpg':

convert image.jpg -colorspace Gray image-bw.jpg

To convert an entire directory in images to grayscale:

mkdir bw && for i in *.jpg; do convert $i -colorspace Gray bw/$i; done

The grayscale images will be placed in a subdirectory named 'bw'. To convert something other than JPEGs, just change *.jpg to the appropriate file extension. For more information, see here.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.