Page 1 of 1

Semi transparent text watermark w shadow

Posted: 2011-06-21T13:36:20-07:00
by Tacakas
Hello.

I'm trying use this, but without success

Code: Select all

convert -channel rgba -pointsize 30 -strokewidth 2 "in.jpg" ^( -background transparent -stroke #000b -fill #000a label:"mark" -blur 3x3 -stroke none  -fill #ffff label:"mark" ^) -compose dissolve -define compose:args=50 -composite -quality 100 "out.jpg"
flatten works well, but I need a semi transparent text

Code: Select all

convert -channel rgba -pointsize 30 -strokewidth 2 "in.jpg" ^( -background transparent -stroke #000b -fill #000a label:"mark" -blur 3x3 -stroke none  -fill #ffff label:"mark" ^) -flatten -quality 100 "out.jpg"
Version: ImageMagick 6.6.8-9 2011-03-25 Q16
OS: Win

Re: Semi transparent text watermark w shadow

Posted: 2011-06-21T13:43:24-07:00
by fmw42
In windows, you do not escape the parenthesis.

see http://www.imagemagick.org/Usage/windows/

Re: Semi transparent text watermark w shadow

Posted: 2011-06-21T14:02:25-07:00
by Tacakas
Thanks, but it's not what I asked about.

Code: Select all

convert -channel rgba -pointsize 100 -strokewidth 2 logo: ( -background transparent -stroke #000b -fill #000a label:"mark" -blur 3x3 -stroke none  -fill #ffff label:"mark" ) -compose dissolve -define compose:args=50 -composite -quality 100 out.jpg
What I want:
Image

What I get:
Image

Re: Semi transparent text watermark w shadow

Posted: 2011-06-21T16:22:38-07:00
by anthony
NOTE the fill color "#000a" is a semi-transparent black! You then use a fill color of "#ffff" which is fully-transparent white.
You can NOT draw transparency!!! It is like painting a wall with water -- does nothing what so ever!

Also -blur 3x3 should probably be 0x3!

In your 'good' example you have a 'white' color (dissolve) for the watermark fill, but that is not what you seem to want.

My suggestion to you is... FORGET drawing with transparencies! Just draw the transparency in greyscale (no color), typically so that black = fully transparent (the background and final text fill) and white is transparent (the shadow). Yes that seems inverted, but go with it. Also set the 'dissolve' transparency now by making the whole image darker, bu the disolve amount, that way you can just overlay it like a normal image!

When you have the transparency you want, then use -alpha shape to convert the greyscale image to a colored transparency shape (black or grey) or merge it with a separate drawn colors image.
http://www.imagemagick.org/Usage/masking/#alpha_shape

As an example see compound fonts, using a mask image to generate fonts...
http://www.imagemagick.org/Usage/fonts/#mask
It creates separate color and mask images which are merged to form the final font image. It may not be a blurred image but it is the same technqiue.

When you have your watermark, save it, so you can then overlay it on multiple images. Unless the text is different for each image being watermarked. Here are examples of applying text watermark images.
http://www.imagemagick.org/Usage/annotating/#wmark_text

Re: Semi transparent text watermark w shadow

Posted: 2011-06-22T14:46:30-07:00
by Tacakas
This is what I was looking for:

Code: Select all

convert -channel rgba -pointsize 100 -strokewidth 2 logo: ( -background transparent -stroke #000b -fill #000a label:"mark" -blur 3x3 -stroke none  -fill #ffff label:"mark" -flatten ) -compose dissolve -define compose:args=50 -composite -quality 100 out.jpg
After several test I find out, than multiple `label:` represents as layer and I try to `-flatten` them.
You then use a fill color of "#ffff" which is fully-transparent white.
Here you are wrong, last `f` mean fully solid colour http://www.imagemagick.org/Usage/color_ ... _semitrans

Sorry for my writing mistakes, english is not my native language and thanks for great tool.

Re: Semi transparent text watermark w shadow

Posted: 2011-06-22T16:50:33-07:00
by anthony
Applogies for the color mistake. Typically fully-opaque colors don't specify transparency at all.

From that I gather that you actually want a white center.

However after the flatten consider my suggestion of multiplying alpha by the dissolve amount before saving.
-channel A -evaluate multiply 0.5 +channel
This way you can apply the saved watermark to multiple images simply by composing over them.