3

How I can remove background color from image using GraphicsMagick? I need to delete rgb(255,255,255) and rgb(254,254,254) colors from image and replace them to transparency.

Thank you.

2 Answers 2

5

you should tinker with fuzz -parameter to match #fefefe

gm convert in.png -fuzz 3% -transparent "#ffffff" out.png

1
  • If you are interested in just changing those two specific colors you can avoid the "-fuzz 3%" and just type "gm convert in.png -transparent "#ffffff" -transparent "#fefefe" out.png. Aug 24, 2014 at 19:32
-1

Should comment but cannot.

gm convert -geometry 50x50! -background white -extent 0x0 +matte in.png out.jpg or
gm convert -background color -extent 0x0 +matte src.png dst.png
2
  • It doesn't work. The first solution resizes image without replacing colors. The second doesn't replace colors.
    – Dmitry
    Aug 22, 2014 at 10:29
  • @Dmitry recommend rostok's answr. Just for addition, if you are using firefox, try this gm convert +page alpha.gif beta.gif. The +page removes the unwanted page offset and firefox should behave as assured. It removes the background that prints around your image when it displays in that browser.
    – Pterpatty
    Aug 22, 2014 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.