How to convert gray scale png image to RGB from co

2020-07-21 05:32发布

问题:

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