[CL] Removing background-color replacing it with transparent

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
User avatar
gialloporpora
Posts: 6
Joined: 2011-04-05T05:57:23-07:00
Authentication code: 8675308

[CL] Removing background-color replacing it with transparent

Post by gialloporpora »

Dear all,
it is the first time I ask in this new pretty forum :-), first I have asked my question on mailing list.

I have this question.

The start point is this image:

Image

and other two images like this with contains the minimize and close button.
My goal is to obtains an image with the buttons but with transparent background.

Now my result is this image:

Image


I have successfully used ImageMagick to perform 3 of the steps to obtain the image:

Code: Select all

convert min.png -crop 26x19+0+19 +repage b1.png

Code: Select all

convert b1.png -crop  19x19+4+0  +repage b2.png
At this point I have used Paint.net to remove the background replacing it with transparent background, at the end I have put all together with IM:

Code: Select all

convert b1.png  c2.png b3.png +append  final.png

Is it possible to perform the step for removing background also with IM?

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

Re: [CL] Removing background-color replacing it with transpa

Post by fmw42 »

try this and vary the fuzz XX% as needed


convert buttonmaxi.png -fuzz 30% -transparent "rgba(0,0,0,255)" buttonmaxi_f30trans.png
User avatar
gialloporpora
Posts: 6
Joined: 2011-04-05T05:57:23-07:00
Authentication code: 8675308

Re: [CL] Removing background-color replacing it with transpa

Post by gialloporpora »

Oh, very nice :-D it works like a charm, thanks, I think this will very helpful to me in future :-)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [CL] Removing background-color replacing it with transpa

Post by fmw42 »

gialloporpora wrote:Oh, very nice :-D it works like a charm, thanks, I think this will very helpful to me in future :-)
For relatively new users, good reading at:

http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/script/comma ... ptions.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
Post Reply