Search code examples
imagemagickwandpangopython-3.8

Unable to use parameters with pango while calling wand.image.Image.pseudo method to draw text


I am new to drawing text over an image. I am trying to draw emojis and non-english characters (e.g. Russian, Greek, Arabic etc.) using wand.image.Image.pseudo method in a python script. In this method, I am passing pango command as value for pseudo argument as below -

image.pseudo(width=image.width, height=image.height, pseudo='pango:Привет мир 🙏')

Above statement draws the text successfully but I can not align the text as required.

I tried using -define pango:align=right as mentioned here - https://imagemagick.org/script/formats.php#pseudo but did not work.

Can anyone please suggest me how to do pass all definition inside pseudo method?

Thanks in advance.


Solution

  • Try setting the option before reading the pseudo format.

    image.options['pango:align'] = 'right'
    image.pseudo(width=image.width, height=image.height, pseudo='pango:Привет мир 🙏')