Page 1 of 1

add a watermark but not on transparent pixels

Posted: 2011-08-19T02:42:45-07:00
by webshaker
Hi.
I'm looking to add a watermark but kipping the alpha of the bitmap.

I'm currently use this command
composite -dissolve 50% -gravity SouthEast watermark.png airship.png airship1.png

It give me this result.
http://www.webshaker.net/airship1.png

But what I'd like to have is
http://www.webshaker.net/airship2.png

i.e. not have the watermark on transparent pixels.

That must not be difficult for someone who know how to use imagemagick, but for me...

Thank's

Re: add a watermark but not on transparent pixels

Posted: 2011-08-19T09:31:27-07:00
by fmw42
what does your watermark image look like -- does it have the text all over it? If so create a mask from the other image and use that to limit the text for the watermark image before compositing or white compositing.

If you post your two input image, we can try to give you the commands.

Re: add a watermark but not on transparent pixels

Posted: 2011-08-19T09:52:51-07:00
by webshaker
oups sorry.
I was not clear...

my watermark image is
http://www.webshaker.net/watermark.png

my image source is
http://www.webshaker.net/airship.png

what I want is
http://www.webshaker.net/airship2.png

Thx
Etienne

Re: add a watermark but not on transparent pixels

Posted: 2011-08-19T10:43:16-07:00
by fmw42
try this



# read airship
# read watermark and crop to southeast corner
# extract the alpha channel of the airship image as a mask
# dissolve the airship and the cropped watermark using the mask to limit the watermark
convert airship.png \
\( watermark.png -gravity southeast -crop 256x256+0+0 +repage \) \
\( -clone 0 -alpha extract \) \
-compose dissolve -define compose:args=50,100 -composite \
airship3.png



see
http://www.imagemagick.org/script/compose.php
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/compose/#dissolve
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/basics/#clone


This is unix. If on windows, see difference such as no \ escape on parens and end of line escape change from \ to ^. see http://www.imagemagick.org/Usage/windows/