使用image magick将整个文件夹转换为灰度? [英] Convert entire folder to greyscale using image magick?

查看:125
本文介绍了使用image magick将整个文件夹转换为灰度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用image magick将整个文件夹转换为灰度.

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

convert *.jpg -colorspace Gray -separate -average

遇到此错误:

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

正确的命令是什么?

推荐答案

如果要处理的文件很多,请使用mogrify:

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

magick mogrify -colorspace gray *.jpg

如果您有成千上万的图像和多核CPU,则可以与 GNU Parallel 并行完成所有操作:

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

这篇关于使用image magick将整个文件夹转换为灰度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆