d954bf6227e115209731edea495ae3fb1e8f982f
[wolnelektury.git] / apps / sponsors / processors.py
1 from PIL import Image, ImageFilter, ImageChops
2
3
4 def add_padding(image, requested_size, opts):
5     if 'pad' in opts:
6         padded_image = Image.new('RGBA', requested_size, '#fff')
7         width, height = image.size
8         requested_width, requested_height = requested_size
9         padded_image.paste(image, (0, requested_height - height / 2))
10         return padded_image
11     return image
12
13 add_padding.valid_options = ('pad',)