aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils/halloween/spookifications.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/utils/halloween/spookifications.py')
-rw-r--r--bot/utils/halloween/spookifications.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/bot/utils/halloween/spookifications.py b/bot/utils/halloween/spookifications.py
index 390cfa49..11f69850 100644
--- a/bot/utils/halloween/spookifications.py
+++ b/bot/utils/halloween/spookifications.py
@@ -7,21 +7,19 @@ from PIL import ImageOps
log = logging.getLogger()
-def inversion(im):
+def inversion(im: Image) -> Image:
"""
Inverts the image.
Returns an inverted image when supplied with an Image object.
"""
-
im = im.convert('RGB')
inv = ImageOps.invert(im)
return inv
-def pentagram(im):
+def pentagram(im: Image) -> Image:
"""Adds pentagram to the image."""
-
im = im.convert('RGB')
wt, ht = im.size
penta = Image.open('bot/resources/halloween/bloody-pentagram.png')
@@ -30,14 +28,13 @@ def pentagram(im):
return im
-def bat(im):
+def bat(im: Image) -> Image:
"""
Adds a bat silhoutte to the image.
The bat silhoutte is of a size at least one-fifths that of the original image and may be rotated
up to 90 degrees anti-clockwise.
"""
-
im = im.convert('RGB')
wt, ht = im.size
bat = Image.open('bot/resources/halloween/bat-clipart.png')
@@ -53,9 +50,8 @@ def bat(im):
return im
-def get_random_effect(im):
+def get_random_effect(im: Image) -> Image:
"""Randomly selects and applies an effect."""
-
effects = [inversion, pentagram, bat]
effect = choice(effects)
log.info("Spookyavatar's chosen effect: " + effect.__name__)