Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
Co-Authored-By: Devil <76868561+lucifeermorningstar@users.noreply.github.com>
  • Loading branch information
InukaAsith and lucifeermorningstar committed Jun 26, 2021
1 parent 8bd153a commit 2376896
Show file tree
Hide file tree
Showing 202 changed files with 39,092 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Python cache
__pycache__/
*.py[cod]
*.pyc

# Telethon session cache
*.session
*.session-journal

# Config
data/bot_conf.yaml

# Logs
logs/

# Virtual envirment
venv/

.vscode/
.idea/
247 changes: 247 additions & 0 deletions DaisyX/Addons/ImageEditor/edit_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
# By @TroJanzHEX
import os
import shutil

import cv2
from PIL import Image, ImageEnhance, ImageFilter


async def bright(client, message):
try:
userid = str(message.chat.id)
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
os.makedirs(f"./DOWNLOADS/{userid}")
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "brightness.jpg"
if not message.reply_to_message.empty:
msg = await message.reply_to_message.reply_text(
"Downloading image", quote=True
)
a = await client.download_media(
message=message.reply_to_message, file_name=download_location
)
await msg.edit("Processing Image...")
image = Image.open(a)
brightness = ImageEnhance.Brightness(image)
brightness.enhance(1.5).save(edit_img_loc)
await message.reply_chat_action("upload_photo")
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
await msg.delete()
else:
await message.reply_text("Why did you delete that??")
try:
shutil.rmtree(f"./DOWNLOADS/{userid}")
except Exception:
pass
except Exception as e:
print("bright-error - " + str(e))
if "USER_IS_BLOCKED" in str(e):
return
else:
try:
await message.reply_to_message.reply_text(
"Something went wrong!", quote=True
)
except Exception:
return


async def mix(client, message):
try:
userid = str(message.chat.id)
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
os.makedirs(f"./DOWNLOADS/{userid}")
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "mix.jpg"
if not message.reply_to_message.empty:
msg = await message.reply_to_message.reply_text(
"Downloading image", quote=True
)
a = await client.download_media(
message=message.reply_to_message, file_name=download_location
)
await msg.edit("Processing Image...")
image = Image.open(a)
red, green, blue = image.split()
new_image = Image.merge("RGB", (green, red, blue))
new_image.save(edit_img_loc)
await message.reply_chat_action("upload_photo")
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
await msg.delete()
else:
await message.reply_text("Why did you delete that??")
try:
shutil.rmtree(f"./DOWNLOADS/{userid}")
except Exception:
pass
except Exception as e:
print("mix-error - " + str(e))
if "USER_IS_BLOCKED" in str(e):
return
else:
try:
await message.reply_to_message.reply_text(
"Something went wrong!", quote=True
)
except Exception:
return


async def black_white(client, message):
try:
userid = str(message.chat.id)
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
os.makedirs(f"./DOWNLOADS/{userid}")
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "black_white.jpg"
if not message.reply_to_message.empty:
msg = await message.reply_to_message.reply_text(
"Downloading image", quote=True
)
a = await client.download_media(
message=message.reply_to_message, file_name=download_location
)
await msg.edit("Processing Image...")
image_file = cv2.imread(a)
grayImage = cv2.cvtColor(image_file, cv2.COLOR_BGR2GRAY)
cv2.imwrite(edit_img_loc, grayImage)
await message.reply_chat_action("upload_photo")
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
await msg.delete()
else:
await message.reply_text("Why did you delete that??")
try:
shutil.rmtree(f"./DOWNLOADS/{userid}")
except Exception:
pass
except Exception as e:
print("black_white-error - " + str(e))
if "USER_IS_BLOCKED" in str(e):
return
else:
try:
await message.reply_to_message.reply_text(
"Something went wrong!", quote=True
)
except Exception:
return


async def normal_blur(client, message):
try:
userid = str(message.chat.id)
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
os.makedirs(f"./DOWNLOADS/{userid}")
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "BlurImage.jpg"
if not message.reply_to_message.empty:
msg = await message.reply_to_message.reply_text(
"Downloading image", quote=True
)
a = await client.download_media(
message=message.reply_to_message, file_name=download_location
)
await msg.edit("Processing Image...")
OriImage = Image.open(a)
blurImage = OriImage.filter(ImageFilter.BLUR)
blurImage.save(edit_img_loc)
await message.reply_chat_action("upload_photo")
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
await msg.delete()
else:
await message.reply_text("Why did you delete that??")
try:
shutil.rmtree(f"./DOWNLOADS/{userid}")
except Exception:
pass
except Exception as e:
print("normal_blur-error - " + str(e))
if "USER_IS_BLOCKED" in str(e):
return
else:
try:
await message.reply_to_message.reply_text(
"Something went wrong!", quote=True
)
except Exception:
return


async def g_blur(client, message):
try:
userid = str(message.chat.id)
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
os.makedirs(f"./DOWNLOADS/{userid}")
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "gaussian_blur.jpg"
if not message.reply_to_message.empty:
msg = await message.reply_to_message.reply_text(
"Downloading image", quote=True
)
a = await client.download_media(
message=message.reply_to_message, file_name=download_location
)
await msg.edit("Processing Image...")
im1 = Image.open(a)
im2 = im1.filter(ImageFilter.GaussianBlur(radius=5))
im2.save(edit_img_loc)
await message.reply_chat_action("upload_photo")
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
await msg.delete()
else:
await message.reply_text("Why did you delete that??")
try:
shutil.rmtree(f"./DOWNLOADS/{userid}")
except Exception:
pass
except Exception as e:
print("g_blur-error - " + str(e))
if "USER_IS_BLOCKED" in str(e):
return
else:
try:
await message.reply_to_message.reply_text(
"Something went wrong!", quote=True
)
except Exception:
return


async def box_blur(client, message):
try:
userid = str(message.chat.id)
if not os.path.isdir(f"./DOWNLOADS/{userid}"):
os.makedirs(f"./DOWNLOADS/{userid}")
download_location = "./DOWNLOADS" + "/" + userid + "/" + userid + ".jpg"
edit_img_loc = "./DOWNLOADS" + "/" + userid + "/" + "box_blur.jpg"
if not message.reply_to_message.empty:
msg = await message.reply_to_message.reply_text(
"Downloading image", quote=True
)
a = await client.download_media(
message=message.reply_to_message, file_name=download_location
)
await msg.edit("Processing Image...")
im1 = Image.open(a)
im2 = im1.filter(ImageFilter.BoxBlur(0))
im2.save(edit_img_loc)
await message.reply_chat_action("upload_photo")
await message.reply_to_message.reply_photo(edit_img_loc, quote=True)
await msg.delete()
else:
await message.reply_text("Why did you delete that??")
try:
shutil.rmtree(f"./DOWNLOADS/{userid}")
except Exception:
pass
except Exception as e:
print("box_blur-error - " + str(e))
if "USER_IS_BLOCKED" in str(e):
return
else:
try:
await message.reply_to_message.reply_text(
"Something went wrong!", quote=True
)
except Exception:
return
Loading

0 comments on commit 2376896

Please sign in to comment.