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
    Designing for Simplicity

    Before we get started, it's worth me spending a brief moment introducing myself to you. My name is Mark (or @integralist if Twitter happens to be your communication tool of choice) and I currently work for BBC News in London England as a principal engineer/tech...

  • By
    Animated 3D Flipping Menu with CSS

    CSS animations aren't just for basic fades or sliding elements anymore -- CSS animations are capable of much more.  I've showed you how you can create an exploding logo (applied with JavaScript, but all animation is CSS), an animated Photo Stack, a sweet...

Incredible Demos

  • By
    Check All/None Checkboxes Using MooTools

    There's nothing worse than having to click every checkbox in a list. Why not allow users to click one item and every checkbox becomes checked? Here's how to do just that with MooTools 1.2. The XHTML Note the image with the ucuc ID -- that...

  • By
    Translate Content with the Google Translate API and JavaScript

    Note:  For this tutorial, I'm using version1 of the Google Translate API.  A newer REST-based version is available. In an ideal world, all websites would have a feature that allowed the user to translate a website into their native language (or even more ideally, translation would be...

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!