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?
Copyright symbol in text
Re: Copyright symbol in text
This works for me with windows XP:
Using php on my local server:
IM version 6.3.7 11/14/07
Code: Select all
convert -size 300x50 xc:grey30 -font Arial -pointsize 20 -gravity center -fill grey70 -annotate +0+0 "©2007" stamp_fgnd.png
Code: Select all
exec("convert -size 300x50 xc:grey30 -font Arial -pointsize 20 -gravity center -fill grey70 -annotate +0+0 \"©2007\" stamp_fgnd.png");
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Copyright symbol in text
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
http://imagemagick.org/Usage/text/text/#unicode
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Copyright symbol in text
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:
The second annotation step has me stumped, though. The instructions say:
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 grey30 -fill grey70 -font Arial -pointsize 15 -gravity center label:@copyright.txt stamp_fgnd.png
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
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Copyright symbol in text
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"
Read IM Examples, Text to Image conversion.
PS: It will create a new image based on the text file "copyright.txt"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/