1 from PIL import Image, ImageFilter, ImageChops
4 def add_padding(image, requested_size, opts):
6 padded_image = Image.new('RGBA', requested_size, '#fff')
7 width, height = image.size
8 requested_width, requested_height = requested_size
10 padded_image.paste(image, (0, (requested_height - height) / 2))
14 add_padding.valid_options = ('pad',)