ThomasReggi
ThomasReggi

Reputation: 59365

Center a box with right aligned text

Below I have an example where there's a bg image (red 300x300) and I'd like to have a foreground image (blue 100x100), with text inside it.

Want Have
enter image description here enter image description here
convert -size 300x300 xc:red ( -fill blue -draw rectangle 0,100 100,0  -fill white -pointsize 20 -gravity NorthWest -draw text 0,0 "hello
world" ) -gravity Center

Upvotes: 0

Views: 80

Answers (1)

fmw42
fmw42

Reputation: 53081

Here is one way to do that in ImageMagick. Unix Syntax

convert -size 300x300 xc:red \( -size 100x100 -background blue -pointsize 18 -fill white label:"Hello\nWorld" \) -gravity center -compose over -composite result.png

enter image description here

For Windows syntax, remove the \ before ( and before )

Upvotes: 1

Related Questions