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

后端 未结 4 571
有刺的猬
有刺的猬 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:45

    I just found a very neat thing!

    magicwand 1,1 -t 20 -f image -r outside -m overlay -o 0 image.jpg imgOutput.png
    

    It is a Fred Weinhaus bash script that can be downloaded from here (for non commercial use only). Also there has about 250 scripts!! and this one is amazing! it did exactly the trick, to remove all background while keeping the inner image dots untouched!

    At his page, there are several images as examples so you pick what you need to put on the command line!

    The initial position 1,1 is a general guesser saying all the contour is background.

    Pay attention that the output must be ".png"

提交回复
热议问题