How to replace white background color with transparent of an image in ImageMagick?

后端 未结 4 566
有刺的猬
有刺的猬 2020-12-13 02:24

I have an image in .jpg format with white background color. I want to remove the white background color to transparent in Imagemagick.

4条回答
  •  旧巷少年郎
    2020-12-13 02:48

    First, you need to convert the image format from .jpg to .png format, because JPEG does not support transparency. Then use this command:

    convert image1.png -fuzz 20% -transparent white result.png

    The -fuzz option allows the specified percentage deviation from the pure white colour to be converted to transparent as well. This is useful, for example, when your image contains noise or subtle gradients.

提交回复
热议问题