Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

Convert image to grayscale

Date: 2011-03-23 00:00:00 -0400

Introduction

Grayscale pictures have that je ne sais quoi that usually makes them better than the color ones, at least in my humble opinion, so I usually convert color pictures to grayscale.

We can use convert or mogrify to make this transition from color to grayscale.

Use convert to make a color image a grayscale one

convert -type Grayscale input-picture.png output-picture.png

This will keep your original picture “input-picture.png” in color, and create a new one in grayscale “output-picture.png”

Use mogrify to convert an image to grayscale

mogrify -type Grayscale input-picture.png

I prefer this one, as you can use it to convert bulk pictures to grayscale, with no need to run a bash for loop, or a script.

What I usually do is to copy all files to a new folder, and then run the mogrify command there. Like this:

cp /home/user/my-pics/* /home/user/my-pics-grayscale/

Then run mogrify on the second folder.

mogrify -type Grayscale /home/user/my-pics-grayscale/*

Done, now I have color version of my pictures, and the grayscale images of them.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.