Convert entire folder to greyscale using image mag

2020-07-30 02:44发布

问题:

I am trying to convert an entire folder to grayscale, using image magick.

convert *.jpg -colorspace Gray -separate -average

is met with this error :

convert:  `-average' @ error/convert.c/ConvertImageCommand/3290.

What is the correct command for this?

回答1:

If you have lots of files to process, use mogrify:

magick mogrify -colorspace gray *.jpg

If you have tens of thousands of images and a multi-core CPU, you can get them all done in parallel with GNU Parallel:

parallel -X magick mogrify -colorspace gray ::: *.jpg