Rounded corners using ImageMagick (bakground transparent or white)

老子叫甜甜 提交于 2019-12-05 07:13:18

Finally found a solution :

convert -size "$W"x"$H" xc:none -draw "roundrectangle 0,0,$W,$H,$R,$R" $MASK
convert $SRC -matte $MASK -compose DstIn -composite $TMP_PNG

I'm using a "temp" PNG file as destination. If the output format is not GIF or PNG, I use the "flatten" function of ImageMagick with the white color as background.

convert $TMP_PNG -background white -flatten $DST

For PNG output : simply copy $TMP_PNG to $DST

For GIF output : simply convert $TMP_PNG to $DST

Else : flatten the image as said before.

Hope that helps.

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