Removing simple background from an image

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
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Removing simple background from an image

Post by hiemanshu »

I am using floodfill to remove the background from image (I know the color of the background), and it works well for most cases except when the background is disjoint, for example the Google logo, white color still exists inside the characters (the disjoint white space in the O).

I found that using -transparent works in removing it from the space in the characters as well, is using -transparent a good idea or is there a better way to do this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Removing simple background from an image

Post by fmw42 »

-transparent is the only way to do that without having to floodfill each separate white region.
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Re: Removing simple background from an image

Post by hiemanshu »

Are there any side effects to using -transparent? I'm asking because almost every other post I've found uses floodfill.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Removing simple background from an image

Post by fmw42 »

Only if you have white regions that you want to remain white.
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Re: Removing simple background from an image

Post by hiemanshu »

Ah cool, thanks!
Post Reply