0

I want to install libraqm library in Google colab. I've got a lot of images to work with and to add emoji text on those I need this particular library. I also tried putting pre-built .dlls in the directories but nothing works. Any answer will be helpful.

Also, installing libraqm this way and running the code crashes it.

!sudo apt install libraqm-dev

example of the code I'm trying to run:

from PIL import Image, ImageDraw, ImageFont

def test(font, out_name):
    fnt = ImageFont.truetype(font, size=109, layout_engine=ImageFont.LAYOUT_RAQM)
    im = Image.new("RGBA", (600, 600), (100, 100, 100, 100))
    draw = ImageDraw.Draw(im)
    draw.text((0, 32), "a\u263A", fill="#faa2", embedded_color=True, font=fnt)
    draw.text((0, 132), "a\u263A", fill="#faa8", embedded_color=True, font=fnt)
    draw.text((0, 232), "a\u263A", fill="#faa", embedded_color=True, font=fnt)
    draw.text((0, 332), "\U0001F3AC\U0001F44B\U0001F3FB\U0001F44B\U0001F3FF", fill="white", embedded_color=True, font=fnt)
    draw.text((0, 432), "a\u263A", fill="#faa2", font=fnt)
    im.show()
    im.save(f"testemoji_{out_name}.png")

test(r"C:\Users\Nulano\Downloads\NotoColorEmoji.ttf", "cbdt")
test("seguiemj.ttf", "colr")

1 Answers1

2

Just fixed this for myself !

try this:

!sudo apt install libraqm-dev
!pip3 install -v --upgrade --force-reinstall Pillow
from PIL import features
print(features.check('raqm'))

if you get "True", its gonna work !

  • you had to rebuild Pillow to work with libraqm, make sure you restart your notebook !
Ahmad M.
  • 446
  • 9
  • 20