Page 1 of 1

Why can't I set label geometry when not appending it to another element/image?

Posted: 2016-01-05T04:28:45-07:00
by raehik
I'm trying to create an image from scratch with a set size and background color, and a positioned label. I started with:

Code: Select all

convert -size 1366x768 -background black -fill white -gravity center -pointsize 100 label:"Text here" image.png
This successfully creates a black image with centered white text. I want to move the text to be offset from the center. However, I'm not able to move the label around with -geometry. Why is this not possible? Is there any way to position text over a background without using something like xc:black or overlaying it -- and why do they work while this doesn't?

Re: Why can't I set label geometry when not appending it to another element/image?

Posted: 2016-01-05T05:31:56-07:00
by snibgo
The "-geometry" setting is used by "-composite", and not much else.

"-annotate" includes arguments for xy placement. See http://www.imagemagick.org/script/comma ... p#annotate

Re: Why can't I set label geometry when not appending it to another element/image?

Posted: 2016-01-05T08:01:10-07:00
by raehik
Thanks for the '-annotate' setting. Substituting the 'label:' command for a correctly-formed '-annotate' command doesn't work, however. I think '-annotate' only works when you're annotating an image: I'm making an image rather than overlaying a label on a pre-existing one. (I know I could do it the other way, but I want to know why I can't the first way.)

Re: Why can't I set label geometry when not appending it to another element/image?

Posted: 2016-01-05T08:50:49-07:00
by GeeMack
raehik wrote:Thanks for the '-annotate' setting. Substituting the 'label:' command for a correctly-formed '-annotate' command doesn't work, however. I think '-annotate' only works when you're annotating an image: I'm making an image rather than overlaying a label on a pre-existing one. (I know I could do it the other way, but I want to know why I can't the first way.)
You need to create a canvas with "xc:". Try something like this...

Code: Select all

convert -size 1366x768 xc:black -fill white -gravity center -pointsize 100 -annotate +50+50 "Write your text here." image.png

Re: Why can't I set label geometry when not appending it to another element/image?

Posted: 2016-01-05T09:02:31-07:00
by snibgo
I think '-annotate' only works when you're annotating an image: I'm making an image rather than overlaying a label on a pre-existing one. (I know I could do it the other way, but I want to know why I can't the first way.)
Anything ending with a colon (:) creates a new image. So "xc:", "label:", "caption:" each create a new image. When creating a new image, "-geometry" has no meaning.

Operations start with "-", so "-annotate" is an operation that modifies an image that must already exist.

Re: Why can't I set label geometry when not appending it to another element/image?

Posted: 2016-01-05T14:54:11-07:00
by raehik
Thanks snibgo! Went through a lot of docs but didn't find that out. There are a lot of ways to go about what I was trying to do, but my command was:

Code: Select all

convert -size 1366x768 xc:black \
-pointsize 100 -gravity center -fill white -annotate +300+300 'Text here' outfile.png