Page 1 of 1

Removing Background except inside content

Posted: 2015-09-18T21:52:00-07:00
by kw7
I would like to remove the background from an image (turn white to transparent for example) but only remove it up until the point, actual content is encountered. I dont want white inside the content to be removed.

Here is an example image, the goal would be to remove the white except for the X as it is inside the star.
Image

The ideal output would look like this (the white of the X is maintained)
Image

Right now I am using the following command and the white inside the X is also being removed

Code: Select all

convert target.png -fuzz 5% -fill none -draw "matte 0,0 replace" target-out.png
Is there a way to achieve this from IM?

Re: Removing Background except inside content

Posted: 2015-09-19T00:45:32-07:00
by fmw42
use "matte 0,0 floodfill"

Code: Select all

convert target.png -fuzz 5% -fill none -draw "matte 0,0 floodfill" target-out.png
see
http://www.imagemagick.org/script/magic ... aphics.php
http://www.imagemagick.org/Usage/draw/#matte