How do I add drop shadow to text in an image?
How to add drop shadow to text like in this image: http://i.stack.imgur.com/Qk4kk.png
I am generating text in image with the following code. But I don't know what to do to add a shadow:
gm(filename)
.font("Arial")
.fontSize(72)
.drawText(0, 0, text, 'Center')
.write("./result.png", clb);
+3
source to share
1 answer
The easiest way to make text is with shadows so that it draws the same text twice. The first instance should be shadowed and then the actual text on top.
Example
convert wizard: -font Arial -pointsize 72 -gravity center \
-fill black -draw 'text 1 1 "Hello_World"' \
-fill pink -draw 'text 0 0 "Hello_World"' \
./result.png
You can add blur or other shadow effects depending on the image. See examples .
I don't know much about javascript gm
, but I would guess it might look something like ...
gm(filename)
.font("Arial")
.fontSize(72)
.fill(shadowColor)
.drawText(1, 1, text, 'Center')
.fill(textColor)
.drawText(0, 0, text, 'Center')
.write("./result.png", clb);
+4
source to share