如何使用image magick从命令行将灰度png图像转换为RGB

编程入门 行业动态 更新时间:2024-10-17 09:49:25
本文介绍了如何使用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

本文发布于:2023-07-27 00:03:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219122.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:灰度   转换为   如何使用   图像   命令

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!