Add text below Picture

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Creativ

Add text below Picture

Post by Creativ »

Hi,
i just started working with imagemagick, so maybe my problem is easy to solve :D

I got a picture and I want to add with imagemagick a text with black background-color below the picture. So it is supposed to look like the thumbnails at imageshack.us:

Code: Select all

+----------------+
+     PICTURE  +
+                    +
+                    +
+----------------+
+     TEXT        +
+----------------+
I hope you understand what i mean.
How can i do this?

Dennis

P.S.: Sorry for my bad english. I'm from Germany ;)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

There was a similar post here: http://redux.imagemagick.org/discourse- ... php?t=8320

Code: Select all

exec("convert -size 500x500 old.jpg -thumbnail 150x150 -gravity South -bordercolor black -border 1x1 -background Black -splice 0x15 -fill white -draw 'text 0,0 \"150x150 23kb\"' new.jpg");
Creativ

Post by Creativ »

Hi,
Thanks....i almost works perfectly.
There is just one problem:
There isn't any Text.
I tried the following:

Code: Select all

exec("convert -size 500x500 Capture005.jpg -thumbnail 250x250 -gravity South -bordercolor black -border 1x1 -background Black -splice 0x25 -fill white -draw 'text 0,0 \"150x150 23kb\"' test2.jpg"); 
But i get the following picture:
Image

What do i do wrong?

Dennis
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

I have had a similar problem along with others when it comes to text.

All I can suggest is upload a font to the same folder as the code and try to add the font path to the code.
In this case I have uploaded Arial.ttf

Code: Select all

exec("convert -size 500x500 Capture005.jpg -thumbnail 250x250 -gravity South -bordercolor black -border 1x1 -background Black -splice 0x25 -font Arial.ttf -fill white -draw 'text 0,0 \"150x150 23kb\"' test2.jpg");
Creativ

Post by Creativ »

Thank You!

Now it works perfectly fine! :D
Post Reply