Caption positioning on a background problem - advice sought!

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
markth
Posts: 9
Joined: 2013-06-19T03:47:53-07:00
Authentication code: 6789

Caption positioning on a background problem - advice sought!

Post by markth »

Hi all

I have been battling for a couple of days with correct syntax, going around the houses. I have a background image that is 1024 x 768 px, and I want to drop a caption (of area 400 x 200) onto it, but at a position 150px from the left and 100px from the top. I can get the caption (with DropShadow!) onto the background image but I'll be a monkey's something if I can then position it correctly onto the background.

Here's where I am:

C:\imagemagick\convert.exe "background.jpg" ( -background none -fill white -kerning -2 -font "fonts\gotham.ttf" -geometry 44x44 -size 400x200 caption:"The Text I Want On The Image" ( +clone -shadow 60x2+1+1 ) +swap ) -layers merge "outputfile.jpg"

Any guidance on how to position the caption layers would be great.
markth
Posts: 9
Joined: 2013-06-19T03:47:53-07:00
Authentication code: 6789

Re: Caption positioning on a background problem - advice sou

Post by markth »

PS the caption is positioning itself top left at the moment.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Caption positioning on a background problem - advice sou

Post by snibgo »

Code: Select all

convert -size 1024x768 xc:blue background.jpg

convert ^
  "background.jpg" ^
  ( -background none -fill white ^
    -kerning -2 -font "Arial" ^
    -size 400x200 ^
    caption:"The Text I Want On The Image" ^
    ( +clone -shadow 60x2+1+1 ) ^
    +swap ^
    -layers merge ^
    -repage +150+100 ^
  ) ^
  -layers merge ^
  "outputfile.jpg"
I have merged your caption and shadow then set a "-repage".

I've also removed "-geometry 44x44" as it didn't seem to be doing anything (but I could be wrong).
snibgo's IM pages: im.snibgo.com
markth
Posts: 9
Joined: 2013-06-19T03:47:53-07:00
Authentication code: 6789

Re: Caption positioning on a background problem - advice sou

Post by markth »

That's brilliant - thank you very much for your help - it has put me back on the right course!
Post Reply