如何使用image magick从命令行将灰度png图像转换为RGB [英] How to convert gray scale png image to RGB from comand line using image magick

查看:149
本文介绍了如何使用image magick从命令行将灰度png图像转换为RGB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下命令将png灰度图像转换为RGB png图像。

I am trying to convert an png Gray scale image to RGB png image using the following command.

convert HopeLoveJoy.png -size 1x1 -fill "rgba(0%,1%,2%,0)" -draw "color 511,511 point" out_test.png 

通过使用上面的命令,我可以转换,但图像的颜色会发生变化。
命令中有什么问题吗?
任何帮助表示赞赏。
提前致谢。

By using the above the above command I am able to convert but the color of the image is getting changed. Is any thing wrong in the command?? Any help is appreciated. Thanks in advance.

推荐答案

如果你的问题标题暗示,你真的只想从灰度到sRGB色彩空间,使用此:

If, as your question title implies, you really just want to go from greyscale to sRGB colorspace, use this:

convert image.png -define png:color-type=2 result.png

我这样检查:

convert image.png -define png:color-type=2 result.png && identify -format "%[colorspace]" result.png
sRGB

这篇关于如何使用image magick从命令行将灰度png图像转换为RGB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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