Skip to content

Commit

Permalink
Update plugin_helpers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
StarkGang authored Apr 20, 2021
1 parent e8c369c commit ee8d234
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion main_startup/helper_func/plugin_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import subprocess
import textwrap
from json import JSONDecodeError

import numpy as np
from PIL import Image, ImageDraw
import requests
from PIL import Image, ImageDraw, ImageFont
from pymediainfo import MediaInfo
Expand Down Expand Up @@ -120,6 +121,20 @@ async def convert_vid_to_vidnote(input_vid: str, final_path: str):
os.remove(input_vid)
else:
os.rename(input_vid, final_path)

async def convert_image_to_image_note(input_path):
"""Crop Image To Circle"""
img = Image.open(input_path).convert("RGB")
npImage = np.array(img)
h, w = img.size
alpha = Image.new('L', img.size,0)
draw = ImageDraw.Draw(alpha)
draw.pieslice([0,0,h,w],0,360,fill=255)
npAlpha = np.array(alpha)
npImage = np.dstack((npImage,npAlpha))
img_path = 'converted_by_FridayUB.png'
Image.fromarray(npImage).save(img_path)
return img_path


async def is_nsfw(client, message, is_reply=True):
Expand Down

0 comments on commit ee8d234

Please sign in to comment.