Jump to content

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:
Code:

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>
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.
martin@linux-70ce:~/Bilder>


 

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}"

done;
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.