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-02T21:14:52-07:00
Authentication code: 1152

How to remove the background of selected area

Post by dantruong02 » 2018-01-02T21:17:02-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: 22486
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to remove the background of selected area

Post by fmw42 » 2018-01-02T21:33:51-07:00

Why do you not just use the vector logo?

Any way, try this adding -fuzz to allow colors close to white to be made transparent. The problem with jpg images is that solid colors are not purely solid due to the compression.

Code: Select all

convert nsf1sm.jpg -fuzz 15% -transparent white result.png

Post Reply