if not bg or not fg:
log.warning("Can't open Delta foreground and/or background image!")
return None
- cutoff = bg.width / 2
+ cutoff = float(bg.width) / 1.5
# Get provided image.
fd = open_url(url)
if image.height > cutoff:
image.thumbnail((cutoff, cutoff))
elif image.height < cutoff:
- width = image.width * 2
- height = image.height * 2
+ width = math.floor(image.width * (float(fg.width) / cutoff))
+ height = math.floor(image.height * (float(fg.height) / cutoff))
bg.thumbnail((width, height))
fg.thumbnail((width, height))
# Pad with blank pixels.
- padded = Image.new(image.mode, fg.size)
+ padded = Image.new(bg.mode, fg.size)
left = math.floor((padded.width - image.width) / 2)
top = math.floor((padded.height - image.height) / 2)
padded.paste(image, (left, top, left + image.width, top + image.height))
url = m.group(1)
elif len(message.attachments):
url = message.attachments[0]['url']
+ else:
+ log.info('Using avatar URL {}'.format(url))
+ url = message.author.avatar_url
if url is None:
log.debug('No URL for avatar to Deltaify')
yield from say(message.channel, 'zzz')
yield from say(message.channel, 'yelp!')
return
yield from client.send_file(message.channel, data, filename = message.author.name + '.png', content = message.author.mention if not message.channel.is_private else 'purr')
+ return
elif command == 'debug':
# debug