How to convert gray scale png image to RGB from comand line using image magick

时光毁灭记忆、已成空白 提交于 2020-01-22 16:03:07

问题


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.


回答1:


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

I check it like this:

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


来源:https://stackoverflow.com/questions/34305379/how-to-convert-gray-scale-png-image-to-rgb-from-comand-line-using-image-magick

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!