Page 1 of 1

Get dimensions to insert text when image box dimensions are known

Posted: 2018-08-27T02:27:08-07:00
by weareborg
Hello friends,

We are working on adding some text dynamically in the image. Our designers will allocate a box inside each image and give us the dimensions, location of the box as shown in the image below. I tried to add text, but the X and Y axis required are very different from the ones provided by our design team. How can I add text in an image with dimensions and location based upon Pixels. Image height and width is known in pixels. Thank you.

Image

Command used :

Code: Select all

convert output.png -gravity West -pointsize 30 -annotate +120+225 'my crazy cat' output.jpg 

Re: Get dimensions to insert text when image box dimensions are known

Posted: 2018-08-27T03:08:19-07:00
by snibgo
You have "-gravity West", so the starting point for "-annotate" offsets is half-way down the left side. It seems more sensible to have "-gravity NorthWest" to start from the top-left corner, or perhaps SouthWest to start from bottom-left.