Skip to content

Commit

Permalink
Merge pull request #176 from crimsobot/bends-album-maker
Browse files Browse the repository at this point in the history
The Bends album cover maker
  • Loading branch information
h-anjru authored Jul 31, 2024
2 parents 640465c + de5b5ab commit eb89c62
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crimsobot/cogs/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from crimsobot.data.img import (
AENIMA,
AEROPLANE,
BENDS,
CAPTION_RULES,
CURRENTS,
DAMN,
Expand Down Expand Up @@ -195,6 +196,18 @@ async def aeroplane(self, ctx: commands.Context, image: Optional[str] = None) ->

await self.get_image_and_embed(ctx, image, effect, None, title)

@commands.command()
async def bends(self, ctx: commands.Context, image: Optional[str] = None) -> None:
"""Make a new cover for The Bends."""

effect = 'bends'
title = random.choice(BENDS)

if image is None:
image = await self.get_previous_image(ctx) # will be a URL

await self.get_image_and_embed(ctx, image, effect, None, title)

@commands.command(hidden=True)
@commands.cooldown(1, 4 * 60 * 60, commands.BucketType.user)
@shared_max_concurrency(eface_bucket)
Expand Down
1 change: 1 addition & 0 deletions crimsobot/data/img/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

AENIMA = _ruleset['aenima']
AEROPLANE = _ruleset['aeroplane']
BENDS = _ruleset['bends']
CURRENTS = _ruleset['currents']
DAMN = _ruleset['damn']
LATERALUS = _ruleset['lateralus']
Expand Down
37 changes: 37 additions & 0 deletions crimsobot/data/img/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,43 @@ aeroplane:
- Blister, please, with those wings in your spine
- Secret songs that you keep wrapped in boxes so tight
- Your brains fell out through your teeth
bends:
- You can force it but it will not come
- You can crush it dry as a bone
- Everything is broken
- Where are you now when I need you?
- Baby's got the bends
- The planet is a gunboat in a sea of fear
- Don't leave me high, don't leave me dry
- You're turning into something you're not
- It's the best thing that you ever had
- And it wears him out
- She looks like the real thing
- A cracked polystyrene man who just crumbles and burns
- Pieces missing everywhere
- I used to fly like Peter Pan
- When you've got to feel it in your bones
- They love me like I was a brother
- But the sea would electrocute us all
- Nice dream
- Can't get the stink off
- Comes like a comet
- And teach you how to get to purest hell
- Suck, suck your teenage thumb
- My brain says I'm receiving pain
- The headshrinkers, they want everything
- Limb by limb and tooth by tooth
- Lead-fill the hold in me
- Wax me, mould me, heat the pins and stab them in
- What are we coming to?
- Blame it on the black star
- Troubled words of a troubled mind
- Each time it comes it eats me alive
- Disaffected and eager to please
- Sometimes you sulk, sometimes you burn
- Rows of houses, all bearing down on me
- I can feel their blue hands touching me
- I can feel death, can see its beady eyes
currents:
- All this running around
- Just let it happen
Expand Down
Binary file added crimsobot/data/img/the_bends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions crimsobot/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,29 @@ def make_aeroplane_img(img: Image.Image, arg: None) -> Image.Image:
return bg


def make_bends_img(img: Image.Image, arg: None) -> Image.Image:
# 1. determine user image size, resize to fit in its place
width, height = img.size

# resize to album asset width (600 px)
ratio = width / 600

img = img.resize((int(width / ratio), int(height / ratio)), resample=Image.BICUBIC)

# get new size
width, height = img.size

# 2. paste input image over dark bg
bg = Image.new('RGBA', (width, height), (13, 16, 19, 255))
bg.alpha_composite(img)

# 3. paste wordmark over result (aligned/affixed to bottom)
with Image.open(c.clib_path_join('img', 'the_bends.png')) as wordmark:
bg.alpha_composite(wordmark, (0, height - 600))

return bg


def make_captioned_img(img: Image.Image, caption_list: List[str]) -> Image.Image:
"""Captions an image!"""
# 1. determine image size, resize to standardize text addition
Expand Down Expand Up @@ -736,6 +759,7 @@ def process_lower_level(img: Image.Image, effect: str, arg: int) -> BytesIO:
'acid': make_acid_img,
'aenima': make_aenima_img,
'aeroplane': make_aeroplane_img,
'bends': make_bends_img,
'caption': make_captioned_img,
'currents': make_currents_img,
'damn': make_damn_img,
Expand Down

0 comments on commit eb89c62

Please sign in to comment.