image_processing.py
def resize_and_draw_watermark(max_width: int, max_height: int, image: str) -> None:
    """
    Opens an image from the received, resizes if needed and adds watermark
    on it so the final GIF would be with watermark.

    :param max_height: max height to resize smaller images
    :param max_width: max width to resize smaller images
    :param image: url as a string
    :return: None
    """
    with Image.open(image) as image:
        rgb_image = image.convert("RGB")
        rgb_image.save(image.filename)
        background = Image.new("RGB", (max_width, max_height), (255, 255, 255))
        offset = ((max_width - image.width) // 2, (max_height - image.height) // 2)
        background.paste(rgb_image, offset)
        draw = ImageDraw.Draw(background)
        text = "Picture process bot"
        font = ImageFont.truetype("fonts/UKIJDiY.ttf", 62, encoding="UTF-8")
        width, height = background.size
        draw.text((0, height // 2), text, (240, 240, 240), font=font)
        background.save(image.filename)
        background.close()
        rgb_image.close()

    Opens an image from the received, resizes if needed and adds watermark
    on it so the final GIF would be with watermark.

    :param max_height: max height to resize smaller images
    :param max_width: max width to resize smaller images
    :param image: url as a string
    :return: None
    
Opens an image from the received, resizes if needed and adds watermark
on it so the final GIF would be with watermark.
Opens an image from the received resizes if needed and adds watermark on it so the final GIF would be with watermark .
def resize_and_draw_watermark(max_width: int, max_height: int, image: str) -> None:
    with Image.open(image) as image:
        rgb_image = image.convert("RGB")
        rgb_image.save(image.filename)
        background = Image.new("RGB", (max_width, max_height), (255, 255, 255))
        offset = ((max_width - image.width) // 2, (max_height - image.height) // 2)
        background.paste(rgb_image, offset)
        draw = ImageDraw.Draw(background)
        text = "Picture process bot"
        font = ImageFont.truetype("fonts/UKIJDiY.ttf", 62, encoding="UTF-8")
        width, height = background.size
        draw.text((0, height // 2), text, (240, 240, 240), font=font)
        background.save(image.filename)
        background.close()
        rgb_image.close()
def resize_and_draw_watermark ( max_width : int , max_height : int , image : str ) -> None : with Image . open ( image ) as image : rgb_image = image . convert ( "RGB" ) rgb_image . save ( image . filename ) background = Image . new ( "RGB" , ( max_width , max_height ) , ( 255 , 255 , 255 ) ) offset = ( ( max_width - image . width ) // 2 , ( max_height - image . height ) // 2 ) background . paste ( rgb_image , offset ) draw = ImageDraw . Draw ( background ) text = "Picture process bot" font = ImageFont . truetype ( "fonts/UKIJDiY.ttf" , 62 , encoding = "UTF-8" ) width , height = background . size draw . text ( ( 0 , height // 2 ) , text , ( 240 , 240 , 240 ) , font = font ) background . save ( image . filename ) background . close ( ) rgb_image . close ( )
Opens an image from the received, resizes if needed and adds watermark
on it so the final GIF would be with watermark.
Opens an image from the received resizes if needed and adds watermark on it so the final GIF would be with watermark .
"""
    Opens an image from the received, resizes if needed and adds watermark
    on it so the final GIF would be with watermark.

    :param max_height: max height to resize smaller images
    :param max_width: max width to resize smaller images
    :param image: url as a string
    :return: None
    """
None
max_width
int
max width to resize smaller images
max width to resize smaller images
max_height
int
max height to resize smaller images
max height to resize smaller images
image
str
url as a string
url as a string