给定具有透明背景的输入图像sample.i.png
:
如何将其背景转换为背景为sample.o.png
的文件rgb(160,160,255)
,不透明度为100%(或1)。
使用的答案:
convert source.png -background "rgb(160,160,255)" -flatten out.png
请点击emcconville的答案!
答案 0 :(得分:6)
来自Mark Random's suggestion。使用您的颜色创建背景图像,并在其上展平源图像。
convert -size 150x150 xc:"rgb(160,160,255)" source.png -layers flatten out.png
修改强> 如果您不想担心图像大小,只需直接更改背景。
convert source.png -background "rgb(160,160,255)" -flatten out.png
添加-flatten以重新设置背景颜色