Kurang aqua

This commit is contained in:
Yasir Aris M 2024-07-29 11:40:35 +07:00 committed by GitHub
parent a44c9cc3dc
commit 6f0801ed27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -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)

View file

@ -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")