Page 1 of 1

Remove Solid Color Background

Posted: 2018-05-09T15:35:44-07:00
by pogonomic
Need to sap the pink out of an image but the pink comes in variants. e.g. #F700F8 #F800F7 #F700FF #FF00FF, etc

Base command: magick convert bear.png -transparent #F800F7 bear2.png

I've also tried -fuzz (1-100% and massive integers), -trim, and -transparent-color but still comes out with spotted background.
Any help is appreciated. Using the latest version.

Original:
Image
Result:
Image

Re: Remove Solid Color Background

Posted: 2018-05-09T16:20:23-07:00
by snibgo
Please say what version of IM you use, on what platform.

For v7, I suggest you use "magick" not "magick convert".

For me, v7.0.7-28 on Windows 8.1, this works fine:

Code: Select all

magick k2svX7r.png -fuzz 5% -transparent #F800F7 out.png
If you are using Windows BAT, don't forget to double the %.

Re: Remove Solid Color Background

Posted: 2018-05-09T17:24:54-07:00
by pogonomic
Ah perfect, that did work. Thank you!

v7.0.7-31-Q16-x64; Win 7 Pro 64

Any suggestions on skimming that last little pink edge?

Image

Re: Remove Solid Color Background

Posted: 2018-05-09T19:08:56-07:00
by fmw42
Either increase the fuzz value or extract the alpha channel after using the -fuzz command and antialias it with a blur.

For the latter, you can try the following

Code: Select all

magick k2svX7r.png -fuzz 5% -transparent #F800F7 -channel alpha -blur 0x2 -level 50x100% +channel output.png
If in a bat file, you need to double the % to %%

Re: Remove Solid Color Background

Posted: 2018-05-09T21:53:21-07:00
by pogonomic
Thank you very much! :]