white background -> transparent background

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
BobT
Posts: 1
Joined: 2013-09-06T09:06:23-07:00
Authentication code: 6789

white background -> transparent background

Post by BobT »

Is it possible to use IM to transform the white background of a PNG image to transparent? The foreground material is black.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: white background -> transparent background

Post by snibgo »

convert in.png -transparent white out.png
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: white background -> transparent background

Post by anthony »

However if your edges are not pure white you will get a lot of problems.

Background removal is no easy task, especially without and example.

For more information see IM Examples, Masking, Background Removal
http://www.imagemagick.org/Usage/masking/#bg_remove

It starts simple and gets more complex as needed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply