transparent watermark

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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

I can not think of an easy way to do it. One way would be to make an image containing your text and use that to watermark your image.

One thing I have noticed and that is if you use a transparent background the text does not come out very well.
Anyway if nothing else is suggested you can probably have a play around with this and see if you can improve on it.

Code: Select all

<?php

exec("/usr/local/bin/convert -size 250x60 xc:none -font verdana.ttf -fill black -pointsize 40 -gravity center -draw \" text 0,0 'rubblewebs' \" transparent.gif");

exec("/usr/local/bin/composite -gravity center -dissolve 30% transparent.gif earth.jpg watermark_transparent.jpg");

unlink ( "transparent.gif" );

?>
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

Would this sort of thing do what you want?:

Code: Select all

convert logo: -pointsize 36 -font Times-New-Roman -fill rgba(100%,0,0,0.3) -gravity southwest -annotate +0+0 "Hello Wizards Everywhere!" logo_sig.jpg
rgba sets the colour to pure red and the alpha to 0.3

Note to the wizards: changing the gravity to southeast or northeast chops off the exclamation mark. If I change the string to "Hello Wizards Everywhere!a" then it prints the full string.

Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Looks like the we need a -2 offset for a gravity of NorthEast. We'll investigate and add a patch to ImageMagick 6.3.1-7 Beta. Thanks.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

Interesting el_supremo; trouble is I have not had a lot to do with graphics and still do not understand the different colour specifications along with masks and transparency!

I have tested your code and it works Ok for me using both northeast & southeast.

Version: ImageMagick 6.2.8
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

I should have said what version I was using too: 6.3.1 12/24/06 Q8

Pete
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

One thing I have noticed and that is if you use a transparent background the text does not come out very well.
Anyway if nothing else is suggested you can probably have a play around with this and see if you can improve on it.


Of course text does not come out very well if you use GIF to hold it!

GIF only has boolean transparency, That is it is on, or off. no semi-transparency.
Use PNG or MIFF for th eintermediate image. The former is more compressed and very well known.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply