Jump to content


This topic is now archived and is closed to further replies.


shell script utilizing imagemagick as a stack-programme - to turn images into greyscale

Recommended Posts

hello dear php-experts and freaks

how to view photos and to rapidly change the major categories

i have several hundred images (photographs) taht i want to view on opensuse linux version 13.1

i want to view the images - and of while doing so i want to turn the colored images into b/w

Question; which is the best - ie. the quickest way to do so.

note; i have installed the following thigns on my opensuse 13.1:

- gimp the great grahical tool
- digicam - the great tool to view images and pictures
- Gwenview Version 4.11.4 on KDE 4.11.5

so again here the question: which tool allowes to view the color(ed) image and to turn it - on the fly - in to black and white?

BTW: can i tell linux to swith the colors - in general - to black and white? is this doable...

looks like we could write a small shell script, utilizing imagemagick.

maybe like this:

for i in *jpg ; do mogrify -colorspace Gray "$i" ; done

this is just a quick hack. i have tried. See more bleow:

Also, it's not interactive and simply changes all jpg's to grayscale, even if they already are grayscale.

please note that we need to have some more things about imagemagick.

well see the results:

martin@linux-70ce:~/Bilder> for i in *jpg ; do mogrify -colorspace Gray "$i" ; done
mogrify: unable to open image `*jpg': Datei oder Verzeichnis nicht gefunden @ error/blob.c/OpenBlob/2643.
mogrify: no decode delegate for this image format `*jpg' @ error/constitute.c/ReadImage/552.


Share this post

Link to post
Share on other sites

Most likely the name of this image contains an empty space.


Try to wrap the image's name with curly braces.

for i in *jpg; do

mogrify -colorspace Gray "${i}"


Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.