Q: Fill everything except of transparency 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
llap
Posts: 1
Joined: 2011-04-30T08:46:03-07:00
Authentication code: 8675308

Q: Fill everything except of transparency area

Post by llap »

Hi there,

this is day three of my odyssey, so please forgive my question. I normally find what I'm looking for by searching for it, not by asking for help.

Problem: I've got a picture to fill. Exactly: An area that is defined by being NOT transparent and being completely enclosed by a fully transparent area.

I know ImageMagick can do that. This this is amazing! But.... how? *sigh*

Kind regards,

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

Re: Q: Fill everything except of transparency area

Post by fmw42 »

First line is just to create a test image from the logo: IM internal image:

convert logo: -resize 50% -transparent white logo2t.png

Now color the non-transparent parts red:

convert logo2t.png \
-channel rgb -fill red -colorize 100% +channel \
logo2t_red2.png

or

convert logo2t.png \
\( -clone 0 -alpha off -fill red -colorize 100% \) \
\( -clone 0 -alpha extract \) \
-delete 0 -compose copy_opacity -composite \
logo2t_red.png
Post Reply