Convert an Image to Grayscale with ImageMagick

By  on  
Grayscale Logo

A few years ago I bought a DSLR camera with a bunch of filter effects built in and it's been worth every penny.  I took some incredible photos in London, Paris, and Jamaica, and tooks some really special photos of my son during his first few years.  And many of my favorite photos were taken with grayscale filter but some I took in color and badly wanted them in grayscale.  Of course I can use Photoshop to convert the image to grayscale but that's too much work.  I have ImageMagick -- why not use the shell to very quickly convert it to grayscale?

Converting the image to grayscale with ImageMagick is simple:

convert my-image.jpg -colorspace Gray my-image-gray.jpg

The command is self-explanatory and executes in milliseconds.  And since Photoshop takes a few seconds to start and I have to do the work manually, ImageMagick makes everything so much easier.

Recent Features

  • By
    9 Mind-Blowing WebGL Demos

    As much as developers now loathe Flash, we're still playing a bit of catch up to natively duplicate the animation capabilities that Adobe's old technology provided us.  Of course we have canvas, an awesome technology, one which I highlighted 9 mind-blowing demos.  Another technology available...

  • By
    Page Visibility API

    One event that's always been lacking within the document is a signal for when the user is looking at a given tab, or another tab. When does the user switch off our site to look at something else? When do they come back?

Incredible Demos

Discussion

  1. MaxArt

    How about sepia tones? After all, it’s just like converting to grayscale with a different balance of red, green and blue.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!