It's been 3 or 4 hours I've been searching for it.

This is my command:

convert -gravity center -size 500x500 -background '#263238' -fill white -font "IRANSans.ttf" -pointsize 32 pango:"<span face='IRANSans' foreground='white'>درود</span>" bge.png

The result

But I want to put this text in the middle of the picture. Same thing that this line does in CSS:

vertical-align: middle;
  • 1
    Have you tried label: instead of pango: ? – Marek Rost Jul 30 '16 at 20:57

As commented by Marek Rost:

convert -background '#263238' -fill white -font "IRAN-sans-Regular" \
    -size 500x500  -pointsize 32  -gravity center label:"دورد" bge.png

I reversed the characters. You can list the fonts with convert -list font.

Or with Pango

convert -size 500x500 xc:'#263238' \
    \( -gravity Center -size 100x50 -background none \
    -font "IRANSans.ttf" -pointsize 32 \
    pango:"<span face='IRANSans' foreground='white'>درود</span>" \) \
    -gravity Center -composite bge.png
  • This is exactly what I wanted :) I used another method that used about 3 commands, but this is only one command. That's great! – Ehsaan Jul 31 '16 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.