Skip to content

Instantly share code, notes, and snippets.

@Tewki
Last active November 20, 2015 10:24
Show Gist options
  • Save Tewki/6c9d804a2add7c610dd4 to your computer and use it in GitHub Desktop.
Save Tewki/6c9d804a2add7c610dd4 to your computer and use it in GitHub Desktop.
fuck osu ctb and fuck the weird hitbox system
from PIL import Image, ImageDraw
from sys import exit as exit
_2x = True
amplified_size = 15 # There is no anti aliasing whilst drawing so got to make the image huge & resize it
color = (97, 124, 59, 255) # (Red, Green, Blue, Alpha)
# (147, 46, 195, 255)
fruits = {
'pear': color,
'grapes': color,
'apple': color,
'orange': color,
'drop': (97, 124, 59, 160),
'bananas': (193, 210, 43, 210), # (31, 197, 232, 255),
}
#########################################
_outer_radius = 20 * amplified_size #432 376
_inner_radius = 14 * amplified_size
b_wh = 256 * amplified_size
a_wh = 128
_outer = _inner = xy = b_wh / 2
_outer -= _outer_radius
_inner -= _outer_radius + _inner_radius
_outer = (xy - _outer, xy - _outer, xy + _outer, xy + _outer)
_inner = (xy - _inner, xy - _inner, xy + _inner, xy + _inner)
_types = ['%s'] + (['%s@2x'] if _2x else [])
colors_done = []
im = Image.new('RGBA', (b_wh, b_wh), (0, 0, 0, 0))
draw = ImageDraw.Draw(im)
for fruit, color in fruits.items():
if color in colors_done: continue
draw.ellipse(_outer, fill=color) # outline will not work correctly, thx...
draw.ellipse(_inner, fill=(0, 0, 0, 0))
for type in _types:
img = im.resize((a_wh * 2, a_wh * 2) if '@2x' in type else (a_wh, a_wh), Image.ANTIALIAS)
for _fruit, _color in fruits.items(): # lazy
if _color is color:
[img.save('fruit-' + type % (_fruit + extra) + '.png', "PNG") for extra in ['', '-overlay']]
colors_done.append(color)
print 'go away now'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment