qliq
qliq

Reputation: 11807

How to shade text using imagemagick?

I am wondering how to add a shaded copyright text at the bottom of a jpeg. Currently I simply use:

convert input.jpg  -font /usr/share/fonts/truetype/pointfree/pointfree.ttf -pointsize 15 -fill white -gravity SouthEast -strokewidth 3 -annotate +0+5 "  @blabla.com  " "output.jpg"

The problem with this is that when the background is light the text disappears. I am aware that I could add a flag like

-undercolor '#00000080'

but I find this rather obtrusive, so looking for a better solution that make text's visiblily more independent of the background color. Note: image sizes are different so I can not hardcode the text's coordination.

Upvotes: 0

Views: 322

Answers (2)

qliq
qliq

Reputation: 11807

Ok, finally I found a good batch solution:

for FILE in *.jpg; do convert $FILE -gravity southeast -stroke '#000C' -strokewidth 2 -annotate 0 'blabla.com' -stroke  none   -fill white    -annotate 0 'blabla.com' $FILE; done

Upvotes: 0

Bonzo
Bonzo

Reputation: 5299

Try this:

convert input.jpg  -font /usr/share/fonts/truetype/pointfree/pointfree.ttf -pointsize 15 -gravity SouthEast -strokewidth 3 -fill black -annotate +2+7 "  @blabla.com  "-fill white -annotate +0+5 "  @blabla.com  " "output.jpg"

There was a post on the imagemagick forum from amember which took into consideration the colour under the text and produced a white or black watermark to suite. I was looking for it the otherday and could not find it. It was a batch script from memory.

I had to add the comment here as I was getting some message I did not understand about notifications when trying to add a comment.

Sorry I missed out a space here " @blabla.com "-fill should be " @blabla.com " -fill The command line is very long and would be easier to work with if you split it onto different lines.

Upvotes: 1

Related Questions