convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -fill black -draw "text 28,68 'Anthony'" \ -fill white -draw "text 25,65 'Anthony'" \ font_shadow.jpg
convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -fill black -annotate +28+68 'Anthony' \ -fill white -annotate +25+65 'Anthony' \ font_shadow1.jpg
Same effect.
convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -stroke black -strokewidth 8 -annotate +25+65 'Anthony' -blur 0x8 \ -fill white -stroke none -annotate +25+65 'Anthony' \ font_denser_soft_outline.jpg
The simplist method is to draw the string with a outline to seperate the text from the image. However as the "-stroke" font setting adds thickness to a font both inward and outward, it is a good idea to draw the text twice.
convert logo: -gravity south \ -stroke '#000C' -strokewidth 2 -annotate 0 'Faerie Dragon' \ -stroke none -fill white -annotate 0 'Faerie Dragon' \ anno_outline.jpg
As a final example I will overlay a text string created using a fancy soft outlined font to make sure it remains visible, but without creating a rectangular box for the annotation.
convert -size 100x25 xc:none -gravity center \ -stroke black -strokewidth 2 -annotate 0 'Faerie Dragon' \ -channel RGBA -blur 0x3 \ -stroke none -fill white -annotate 0 'Faerie Dragon' \ +size logo: +swap \ -gravity south -geometry +0-2 -composite anno_fancy.jpg
Steps decomposition:
convert -size 100x25 xc:transparent -gravity center \ -stroke black -strokewidth 2 -annotate 0 'Faerie Dragon' \ -channel RGBA -blur 0x3 \ -stroke none -fill white -annotate 0 'Faerie Dragon' \ anno_fancy.step1.jpg
convert anno_fancy.step1.jpg +size plasma: +swap \ -gravity south -geometry +0-2 -composite anno_fancy.step2.jpg
Excerpted from http://www.ibm.com/developerworks/library/l-graf/?ca=dnt-428 and http://www.imagemagick.org/Usage/text/
-font helvetica sets the annotation's font to Helvetica. It is possible here to specify a path to a font file as well. This example badges the image so it can't be reused by other Web sites without permission, but it does so using a font that is in a non-standard location:
# convert -font fonts/1900805.ttf -fill white -pointsize 36 \ -draw 'text 10,475 "stillhq.com"' \ floriade.jpg stillhq.jpg
You can adjust the position of the label in that extra space by adjusting the "-gravity" setting.
convert -background lightblue -fill blue -font Candice \ -size 160x70 -gravity center label:Anthony label_gravity.gif
Of course if you do not set a "-size" for the label, no extra space will be available in the generated "label:" for "-gravity" to use, making it rather useless.
Now for the best news. If the "-size" setting you give only contains just width or the height for the label, the text "-pointsize" will be set to best fit that dimension, and the other missing dimension will be auto-adjusted to best fit that text!
convert -background lightblue -fill blue -font Candice \ -size 160x label:Anthony label_size_w.gif
Excerpted from
Note, it was http://www.imagemagick.org/Usage/text/
we can create a Chinese label (using a Chinese true-type font), by reading a UTF-8 encoded chinese text file.
convert -background lightblue -fill blue \ -font SimSun -pointsize 48 label:@chinese_words.utf8 \ label_utf8.gif
When drawing text, a large 'letter' sized page is created at the the current resolution (set with "-density"). By default (at 72 dpi) this will be '612x792' pixels in size, which for most purposes is very large.
Because the text is being 'drawn' onto a large canvas, you will likely want to remove all the unused space produced. This can be done by using the image operations "-trim", "+repage", then to make it look reasonable, re-adding some edge space using "-border". Of course you will also need to match the "-background" color you used as the "-bordercolor" you are re-adding.
identify -version | cut -d\ -f1-4 |\ convert -background lightblue -fill blue -pointsize 18 \ text:- -trim +repage -bordercolor lightblue -border 3 \ text_trimmed.gif
In the above example "-trim" is used to remove the extra white space in the "text:" image. Otherwise the resulting image fills this web page. This however will also remove any leading spaces in front of a line!
There is however a interesting technique which will allow you to "-trim" the image down to the size of the actual text drawn onto the page, including any leading and trailing spaces in the input. This uses a special undercolor "-box":
echo " Hello Cruel World " |\ convert -background white -box lightblue -fill blue -pointsize 18 \ text:- -trim +repage -bordercolor white -border 3 \ text_boxed.gif
If you use a transparent background color in the above, you can then flatten the trimmed image to convert the undrawn areas into the same color and the 'undercolor box' used.
echo " Hello Cruel World " |\ convert -background none -box lightblue -fill blue -pointsize 18 \ text:- -trim +repage -bordercolor lightblue -border 3 \ -background lightblue -flatten text_box_trimmed.gif
http://www.imagemagick.org/Usage/fonts/
The "-shade" operator can be used to generate very nice looking 3D font with a beveled and smoothly curving edge.
convert -size 320x100 xc:black -font Candice -pointsize 72 \ -fill white -annotate +25+65 'Anthony' \ -shade 140x60 font_beveled.jpg
This is much nicer than the stamped font, but shade will only generate grey-scale images. On the other hand their are a lot of methods which can replace the grey scale of the above result with whatever colors you need.
Better versions of these beveled fonts can be found in the examples on Shade 3D Highlighting. http://www.imagemagick.org/Usage/transform/#shade
The "-stroke" setting allows you to draw an outline of the font directly. Normally the stroke color is set to "none", so is not used. The thickness of the stroke is varied with "-strokewidth", which defaults to a good value of 1.
convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -fill white -stroke black -annotate +25+65 'Anthony' \ font_stroke.jpg
And here is an example with a heavier stroke width of 3.
convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -fill white -stroke black -strokewidth 3 \ -annotate +25+65 'Anthony' font_stroke_3.jpg
Notice how the stroke color eats away not only the outside of the font, but the inside as well. For more detail see the results of my Stroke and Stroke Width Options.
By turning off the fill color, you can leave just the outline of the font.
convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -fill none -stroke black -annotate +25+65 'Anthony' \ font_stroke_thin.jpg
A straight spreading of a font color using "-blur" operator. This operator allows you to take a image and spread it out in all directions. This allows you to generate softer looking shadows, and or spray paint like effects. The following examples show the effects you can achieve with this.
convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -annotate +25+65 'Anthony' -blur 0x3 font_fuzzy.jpg
use the fuzzy font as the outline border. This is like using the original font as a mask to a spray gun. Note that the edge is very light as not only is the black color spread out, but the background color spreads inward.
convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -annotate +25+65 'Anthony' -blur 0x5 \ -fill white -annotate +25+65 'Anthony' font_outline_soft.jpg
documented on: 2006.11.19
Newsgroups: gmane.comp.video.image-magick.user Date: Tue, 05 Dec 2006 16:14:54 +1000
| I'm trying to tweak Anthony's helpful Text to Image Handling Examples to | create a glowing effect, character strokes are as if glowing in the dark, | like the neon-lights.
That is simple. First a black (or dark) background is needed.
Second a 'soft outline blur' compound font is used of the same color rather than a different color!
http://www.imagemagick.org/Usage/fonts/#soft_outline
With the right font it sould come out quite good.
For example…
convert -fill dodgerblue -background black -font Anaconda -pointsize 72 \ label:' I M Examples ' -bordercolor black -border 30x30 \ \( +clone -blur 0x25 -evaluate multiply 2 \) \ -compose screen -composite neon_sign.gif
This has been added to IM Examples, Compound Fonts, Advanced… http://www.imagemagick.org/Usage/fonts/#advanced
With more work you can even do some shading on the base font itself to make it look more 'tube' like, or rather than use -multiply, you could layer two or more blurs of different sizes to produce a more realistic effect.
Of course the result is idealised, and you may need to add some 'unlit tubes' to connect up the individul letters.
Alturnativally. you can find GIF animated letters of flashing neon tubes. This could be appended together, and may give be the oppunity to actually write 'animated append' for the simple case of animates that are time syncronized. (the next example I need to write!)
| But I realize that it might be too ambitious to me.
Not at all.
| So I lower my anticipation to achieve something like what real camera | imprint date onto the films, not digital camera imprint date on | pictures -- the difference is the glowing effect. But looking at my | result, I guess I've failed this also. :-)
Nope. though to overlay on images, you whate to invert the 'glow' to make the text standout.
An example of this is the very last IM Examples on the annotation page… http://www.imagemagick.org/Usage/annotating/#practical
| Hope that it can be done so that my annotated photos would look superb. :-) | I hoep so to.. This is what Im is all about.
| BTW, here is how I did, | | bg=aquamarine4 | fg=green4 | wd="Neon Title or glowing date/time" | fs=12 | | convert -size 320x100 xc:DeepSkyBlue4 -font Candice -pointsize $fs -fill $fg -gravity center -annotate 0x20+0+0 "$wd" font_outline_soft-$fg.$bg.$fs.jpg | | convert -size 320x100 xc:DeepSkyBlue4 -font Candice -pointsize $fs -gravity center -annotate 0x20+0+0 "$wd" -blur 0x3 -fill $fg -annotate 0x20+0+0 "$wd" font_outline_soft-$fg.$bg.$fs.jpg
Not bad, though the colors are a bit glary, and you should use a thinner font.
The problem is a thin font produces very little outline effects. that can be solved by using a thick stroke for the outline parts, See Denser Soft outline font… http://www.imagemagick.org/Usage/fonts/#denser_soft_outline OR by useing a fast evaluate to increase the results of the blur as was done in the annotation example.
The trickyness is that you create the font on a transparent canvas, and only when you are finished do you actually overlay it on the image.
Anthony Thyssen
Subject: Suggestion to Digital Photo Handling section, part 1 Date: Sun, 17 Jun 2007 18:57:40 +0000 (UTC) Newsgroups: gmane.comp.video.image-magick.user
Hi Anthony,
I've got some suggestions to your Digital Photo Handling section. http://www.imagemagick.org/Usage/photos/
FYI, If you still remember me, I'm the one who asked your help on producing the neon glowing effect.
The effect can also help produce the effect that real camera imprinting date onto the films, not digital camera imprint date on pictures — the difference is the glowing effect.
As we know, most digital camera won't imprint date on the pictures, so I think you may want to add how to do this to your digital photo handling section. Thanks to your help, I managed to create such glowing date imprints onto my digital photos. I am satisfied with the result, and from now on I won't let digital camera do it for me even if it can, because I believe date imprinted this way looks much better. Still, I consider it in pilot stage, and writing to ask for your comments.
Fist some background,
I set my picture size on my digital camera to be 1600x1200. I think this is the size that can give enough details (normally portrait, not scenery), even for digital printing. What's your opinion?
From experiment, I found that using 32 point font size is good for date imprinting for 1600x1200 images. What's your opinion?
Now here is how I did it:
Grab floriade.jpg from http://www.ibm.com/developerworks/library/l-graf/floriade.jpg
then,
convert -resize 1600x1200 floriade.jpg floriade.big.jpg convert -gravity NorthEast -crop 640x480+0+0 floriade.big.jpg floriade-NE.jpg
fg=gold ft=basicdots.ttf fs=32 wd=2007-06-17
convert -size 300x60 xc:none -font $ft -pointsize $fs -gravity center -stroke black -strokewidth 2 -annotate 0 "$wd" -channel RGBA -blur 0x2 -stroke none -fill $fg -annotate 0 "$wd" -blur 0x2 -annotate 0 "$wd" +size floriade-NE.jpg +swap -gravity NorthEast -geometry +50+40 -composite dated.pic.jpg
I put the test result file at http://xpt.sourceforge.net/download/dated.pic.jpg
I noticed that all the strokewidth/blur setting really related to the point font size that we choose, which in turn related to the size of the photo that we work on. This is the setting I found satisfying, via experiment. I want the settings to be enough to make the difference, but just enough as not to interfere with the original photo. My test shows that the settings can still make the imprints distinguishable even on the background that has the same color as the imprint color:
convert -size 300x60 xc:$fg -font $ft -pointsize $fs -gravity center -stroke black -strokewidth 2 -annotate 0 "$wd" -channel RGBA -blur 0x2 -stroke none -fill $fg -annotate 0 "$wd" -blur 0x2 -annotate 0 "$wd" dated.jpg
I'll like your comment before proceeding. E.g., is font size 32 really looks good on floriade.big.jpg? etc.
Thanks
| The effect can also help produce the effect that real camera | imprinting date onto the films, not digital camera imprint date on | pictures -- the difference is the glowing effect. |
the glow or 'halo' effect is there for a good reason. to ensure the text is visible even when the backgorund is the same color of the text. I use the same effect in image annotation… http://www.imagemagick.org/Usage/annotating/#anno_on
| - I set my picture size on my digital camera to be 1600x1200. I | think this is the size that can give enough details (normally | portrait, not scenery), even for digital printing. What's your | opinion? | | - From experiment, I found that using 32 point font size is good | for date imprinting for 1600x1200 images. What's your opinion?
Sorry I have no oppinion on this.
| I'll like your comment before proceeding. E.g., is font size 32 really | looks good on floriade.big.jpg? etc.
I have no idea! Compare it to a real photo. Or measure it on a real photo.
the pointsize however will probbaly be always done to a 'landscape' photo, never portraite. and will probably be related to the size of the image (EG: size for a 4x3 inch photo print) rather than a specific point size. And yes, stroke is also relative.
On method may be to use more complex 'draw' to commands to draw the date on the image in a 'transformed' way so as to pretend the image is always a 4x3 inch print.
Anthony Thyssen