How to create a simple text image with Imagemagick
Imagemagick is a very cool graphic tool. In today's article, I will show you a trick with Imagemagick to create a simple text image with some cool effects. The command you will use is "convert".
For example, to create a "Linux and Life" banner like the one Im using for the site, the command you can use is:
convert -size 560x85 xc:transparent -font Palatino-Bold -pointsize 72 -fill black -draw "text 20,55 'Linux and Life'" linuxandlife.png
And you will get the image below:
In this command:
-size 560x85 : the size (width x height) of the image
-xc:transparent : xc means X window color, use "transparent" to get a transparent background
-fond Palatino-Bold : the font of the text ( type "identify -list font" in the terminal to know all the supported fonts)
-pointsize 72 : the size of the text
-fill black : the color of the text ( check this link to know the names of the supported colors)
-draw "text 20,55 'Linux and Life'" : the position of the text and the text itself
-linuxandlife.png : the output image
You can also add some other effects into this simple text image. For example, to have a red border around the text, you can add "-stroke red" into the above command:
convert -size 560x85 xc:transparent -font Palatino-Bold -pointsize 72 -fill black -stroke red -draw "text 20,55 'Linux and Life'" linuxandlife.png
And here is the result:
Similarly, you can also create a drop shadow for the text image by adding another text in dark, blurred color next to the main text. For example, the argument I can use for the "Linux and Life" image above will be:
-draw "text 25,60 'Linux and Life'" -channel RGBA -gaussian 0x6
The full command will be:
convert -size 560x85 xc:transparent -font Palatino-Bold -pointsize 72 -draw "text 25,60 'Linux and Life'" -channel RGBA -gaussian 0x6 -fill black -stroke red -draw "text 20,55 'Linux and Life'" linuxandlife.png
And here is the result:
This is just a simple trick to do with the command "convert" of Imagemagick. To read more about this, you should check this link, there are a lot of cool things for you to play around.



