(im, min_size=256, fill_color=(0, 0, 0, 0))
| 27 | |
| 28 | |
| 29 | def make_square(im, min_size=256, fill_color=(0, 0, 0, 0)): |
| 30 | x, y = im.size |
| 31 | size = max(min_size, x, y) |
| 32 | new_im = Image.new('RGBA', (size, size), fill_color) |
| 33 | new_im.paste(im, (int((size - x) / 2), int((size - y) / 2))) |
| 34 | return new_im |
| 35 | |
| 36 | |
| 37 | def convert_to_bytes(file_or_bytes, resize=None, fill=False): |