如何使用ImageMagick批量去饱和图像? [英] How to use ImageMagick to batch desaturate images?
问题描述
我的图像是黑色文字,背景为灰色和浅黄色。我基本上想让文字保持尽可能黑,并使灰色和黄色相对较轻......至少将黄色变成浅灰色。在ImageMagick中最有效的方法是什么?
I have an image that is black text with some gray and pale yellowish background. I basically want to keep the text as black as possible, and make the gray and yellow comparatively lighter...at the very least, turn yellow into a light gray. What's the most efficient way to do that in ImageMagick?
推荐答案
回答标题问题:您可以使用选项批量去饱和图像 -colorspace Gray
OR -type Grayscale
OR -modulate 100,0
- 此处参考:选项不起作用
Answering the title question: you can batch desaturate images with the options -colorspace Gray
OR -type Grayscale
OR -modulate 100,0
- reference here: the options don't work identically
示例命令:
mogrify -type Grayscale -path Output_Directory -type Grayscale *.jpg
现在你的帖子......答案的复杂性取决于所涉及的颜色转换。我不是专家,但可能最简单的解决方案(基于你似乎需要的)是去饱和图像,然后使用 -brightness-contrast + 5x25增加对比度(可能是亮度)
(放入你自己的[亮度] x [对比度]值)或 -normalize
(自动) - 此处参考调整对比度
Now as for your post... the complexity of the answer depends on the color transform involved. I'm no expert, but probably the easiest solution (based on what you seem to need) is to desaturate the image(s) and then increase contrast (and maybe brightness) using -brightness-contrast +5x25
(put in your own [brightness]x[contrast] values) or -normalize
(automatic) - reference here for adjusting contrast
示例命令:
mogrify -type Grayscale -path Output_Directory -type Grayscale -normalize *.jpg
这篇关于如何使用ImageMagick批量去饱和图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!