How to remove the background of selected area

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
Posts: 1
Joined: 2018-01-29T08:36:22-07:00
Authentication code: 1152

How to remove the background of selected area

Post by dangdongho1 » 2018-01-29T08:38:51-07:00


I'm trying to convert the NSF logo from NSF official website to a .png file with transparent background.
Here is what I have tried,

convert nsf1.tif nsf1.png
convert nsf1.png -transparent white nsf1-transparent.png

The result is the background along with the 'NSF' letters are transparent, since those 3 letters are also white.
I'm wonder how can I preserve the 'NSF' letters' color from being convert into transparent.

I know there is plenty of this logo with my specification online, but I just want to know how to solve it in ImageMagick.
Here is the resource

Thanks a lot!

User avatar
Posts: 23593
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to remove the background of selected area

Post by fmw42 » 2018-01-29T11:39:01-07:00

You would have to do a flood fill for each white area you want to make transparent. But there is an easier way if you use the EPS version.

Code: Select all

convert -background none -colorspace sRGB nsf1.eps nsf1.png

Post Reply