File size: 599 Bytes
2012550
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import cv2
from .text import TextCensor
from PIL import Image, ImageDraw, ImageFont
import numpy as np

class EmojiCensor(TextCensor):
    def __init__(self, emoji, font="seguiemj.ttf", scale_factor=1.0):
        super().__init__(
            text=emoji,
            font=font,
            scale_factor=scale_factor,
            text_color=None,
            draw_background=False
        )

    def draw_overlay(self, draw, x, y, font):
        draw.text(
            xy=(x, y),
            text=self.text,
            anchor="mm",
            font=font,
            embedded_color=True
        )