Page 1 of 1
Copyright symbol in text
Posted: 2007-12-28T19:51:00-07:00
by RLee
Using the command line with ImageMagick 6.3.7 12/25/07 Q16 on Windows. Trying to follow the example (.../Usage/annotating) on creating a copyright watermark. It has steps like:
convert -size 300x50 xc:grey30 -font Arial -pointsize 20 -gravity center \
-draw "fill grey70 text 0,0 'Copyright'" \
stamp_fgnd.png
I replaced 'Copyright' with '©2007 (my name)' in each step, but the copyright symbol is missing in the final image. I've tried including '-encoding Unicode' but that didn't help. I've confirmed with a hex editor that the correct Unicode encoding (A9) is present in the text. I've confirmed that the Arial font has no problems rendering the symbol. What's the trick?
Re: Copyright symbol in text
Posted: 2007-12-29T02:31:59-07:00
by Bonzo
This works for me with windows XP:
Code: Select all
convert -size 300x50 xc:grey30 -font Arial -pointsize 20 -gravity center -fill grey70 -annotate +0+0 "©2007" stamp_fgnd.png
Using php on my local server:
Code: Select all
exec("convert -size 300x50 xc:grey30 -font Arial -pointsize 20 -gravity center -fill grey70 -annotate +0+0 \"©2007\" stamp_fgnd.png");
IM version 6.3.7 11/14/07
Re: Copyright symbol in text
Posted: 2008-01-01T19:38:52-07:00
by anthony
The main problem is that shells often do not handle meta-characters or even UTF-8 multi-byte characters. The best solution is to avoid the issue by either reading the string from a file or a pipeline, as I showed in the later IM Examples of the page you were looking at.
http://imagemagick.org/Usage/text/text/#unicode
Re: Copyright symbol in text
Posted: 2008-01-05T17:39:53-07:00
by RLee
Thanks, Anthony. Using a file containing the text, I can indeed preserve the character. It appears that I can obtain the desired equivalent of the
first annotation step via:
Code: Select all
convert -background grey30 -fill grey70 -font Arial -pointsize 15 -gravity center label:@copyright.txt stamp_fgnd.png
The
second annotation step has me stumped, though. The instructions say:
Code: Select all
convert -size 300x50 xc:black -font Arial -pointsize 20 -gravity center \
-draw "fill white text 1,1 'Copyright' \
text 0,0 'Copyright' \
fill black text -1,-1 'Copyright'" \
+matte stamp_mask.png
Simply substituting
label:@copyright.txt for
'Copyright' is invalid, not surprisingly. Various attempts to adapt Bonzo's approach (as shown below) instead of
-draw "..." either produce an error or an image which contains, literally,
label:@copyright.txt.
Code: Select all
convert -background black -font Arial -pointsize 15 -gravity center \
-fill white -annotate +1+1 label:@copyright.txt \
-annotate +0+0 label:@copyright.txt \
-fill black -annotate -1-1 label:@copyright.txt \
+matte stamp_mask.png
Re: Copyright symbol in text
Posted: 2008-01-05T22:55:48-07:00
by anthony
The label:@copyright is an operator on its own NOT A STRING. It creates a new image which you can overlay onto the background image.
Read IM Examples, Text to Image conversion.
PS: It will create a new image based on the text file "copyright.txt"