aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils/halloween/spookifications.py
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2019-03-30 10:37:59 -0400
committerGravatar GitHub <[email protected]>2019-03-30 10:37:59 -0400
commit5fe5b7c688e19e533fe34d98b8c754bc67a58beb (patch)
tree16c2946f97f85facf6b994b3c48099d369ee7f5a /bot/utils/halloween/spookifications.py
parentMerge pull request #163 from python-discord/easter_announce (diff)
parentBlank line required between summary line and description. (diff)
Merge pull request #146 from python-discord/flake8-docstring
Implement flake8-docstrings
Diffstat (limited to 'bot/utils/halloween/spookifications.py')
-rw-r--r--bot/utils/halloween/spookifications.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/bot/utils/halloween/spookifications.py b/bot/utils/halloween/spookifications.py
index 5f2369ae..390cfa49 100644
--- a/bot/utils/halloween/spookifications.py
+++ b/bot/utils/halloween/spookifications.py
@@ -8,17 +8,20 @@ log = logging.getLogger()
def inversion(im):
- """Inverts an 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):
- """Adds pentagram to image."""
+ """Adds pentagram to the image."""
+
im = im.convert('RGB')
wt, ht = im.size
penta = Image.open('bot/resources/halloween/bloody-pentagram.png')
@@ -28,10 +31,13 @@ def pentagram(im):
def bat(im):
- """Adds a bat silhoutte to the 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.
+ """
- The bat silhoutte is of a size at least one-fifths that of the original
- image and may be rotated upto 90 degrees anti-clockwise."""
im = im.convert('RGB')
wt, ht = im.size
bat = Image.open('bot/resources/halloween/bat-clipart.png')
@@ -49,6 +55,7 @@ def bat(im):
def get_random_effect(im):
"""Randomly selects and applies an effect."""
+
effects = [inversion, pentagram, bat]
effect = choice(effects)
log.info("Spookyavatar's chosen effect: " + effect.__name__)