-gravity center gives captions on bottom of images

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
San Zamoyski
Posts: 2
Joined: 2016-01-06T10:51:37-07:00
Authentication code: 1151

-gravity center gives captions on bottom of images

Post by San Zamoyski »

Hi!

I have SVG image and i'm trying to put text on it - horizontally and vertically centered, like this:

Code: Select all

convert old_book_cover_1.svg -font Ubuntu-Regular -bordercolor black -fill "#C8B56D" -gravity Center -pointsize 32 -size 540x caption:"Olivia Newton-John" -pointsize 72 -gravity Center -size 540x caption:"Gorączka Sobotniej Nocy" -append -resize 600x +noise gaussian out.png
It works quite cool, but the text is situated UNDER whole original image.

I'm quite new at IM, and sorry it my mistake is obvious.

Regards!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -gravity center gives captions on bottom of images

Post by fmw42 »

Caption creates its own image and needs to be composited over your original image. If you do not want to do the compositing, then use -annotate or -draw, but they will not autofill. See http://www.imagemagick.org/Usage/text/

Untested, but try something like:

Code: Select all

convert old_book_cover_1.svg \
\( -background none -font Ubuntu-Regular -bordercolor black -fill "#C8B56D" \
-gravity Center -pointsize 32 -size 540x caption:"Olivia Newton-John" \
-pointsize 72 -size 540x caption:"Gorączka Sobotniej Nocy" -append \) \
-compose over -composite -resize 600x +noise gaussian out.png
Or separate each caption: command in its own parenthesis, clone and append, delete the pre appended images, then composite over the input.
San Zamoyski
Posts: 2
Joined: 2016-01-06T10:51:37-07:00
Authentication code: 1151

Re: -gravity center gives captions on bottom of images

Post by San Zamoyski »

fmw42 wrote:

Code: Select all

convert old_book_cover_1.svg \
\( -background none -font Ubuntu-Regular -bordercolor black -fill "#C8B56D" \
-gravity Center -pointsize 32 -size 540x caption:"Olivia Newton-John" \
-pointsize 72 -size 540x caption:"Gorączka Sobotniej Nocy" -append \) \
-compose over -composite -resize 600x +noise gaussian out.png
Perfect!

Many thanks!
Post Reply