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?".
Hi, how can I write a centered text in a portion of a imported image? I've tried everything but couldn't position the text using gravity center. The text is dynamic…
This is the example image. The text the user types in must appear centred in the marked area (red square)…
Last edited by rsperes on 2014-11-24T05:43:08-07:00, edited 1 time in total.
With Gimp, I saw that the centre of the red box was roughly 300 pixels left of the centre of the image, and 150 pixels lower. You should use accurate numbers.
snibgo wrote:With Gimp, I saw that the centre of the red box was roughly 300 pixels left of the centre of the image, and 150 pixels lower. You should use accurate numbers.
My happiness does not last long…The alignment gets messy if the text is to short…There's a more precise way to deal with it that adjust to the length of text?
I would suggest you use caption: so that long text is wrapped. Also select a region that provides a bit or margin. I opened your file in another tool, such as GIMP or Photoshop and picked a rectangular region inside your red box. That provided the -size argument and the -geometry argument.
convert example.jpg \
\( -size 508x187 -background none -gravity center -pointsize 50 -fill black \
caption:"Now is the time for all good men to come to the aid of their country" \) \
-gravity northwest -geometry +135+742 -composite output2.jpg