mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Kurang aqua
This commit is contained in:
parent
a44c9cc3dc
commit
6f0801ed27
2 changed files with 3 additions and 1 deletions
|
|
@ -176,7 +176,7 @@ def isValidURL(str):
|
||||||
@asyncify
|
@asyncify
|
||||||
def gen_trans_image(source, path):
|
def gen_trans_image(source, path):
|
||||||
# load image
|
# load image
|
||||||
img = cv2.imread(spurce)
|
img = cv2.imread(source)
|
||||||
|
|
||||||
# convert to graky
|
# convert to graky
|
||||||
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||||
|
|
|
||||||
|
|
@ -179,9 +179,11 @@ async def removebg(_, ctx: Client):
|
||||||
return await ctx.reply_msg("Please reply image.")
|
return await ctx.reply_msg("Please reply image.")
|
||||||
if not ctx.reply_to_message.photo:
|
if not ctx.reply_to_message.photo:
|
||||||
return await ctx.reply_msg("Only support photo for remove background.")
|
return await ctx.reply_msg("Only support photo for remove background.")
|
||||||
|
prg = await ctx.reply("Processing...")
|
||||||
source = await ctx.reply_to_message.download()
|
source = await ctx.reply_to_message.download()
|
||||||
await gen_trans_image(ctx.reply_to_message, f"transp_bckgrnd-{ctx.from_user.id}.png")
|
await gen_trans_image(ctx.reply_to_message, f"transp_bckgrnd-{ctx.from_user.id}.png")
|
||||||
await ctx.reply_photo(f"transp_bckgrnd-{ctx.from_user.id}.png")
|
await ctx.reply_photo(f"transp_bckgrnd-{ctx.from_user.id}.png")
|
||||||
|
await prg.delete_msg()
|
||||||
os.remove(source)
|
os.remove(source)
|
||||||
os.remove(f"transp_bckgrnd-{ctx.from_user.id}.png")
|
os.remove(f"transp_bckgrnd-{ctx.from_user.id}.png")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue