MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / make_square

Function make_square

DemoPrograms/Demo_Emoji_Toolbar_PIL.py:50–67  ·  view source on GitHub ↗

:param im: :type im: :param min_size: :type min_size: :param fill_color: :type fill_color: :return: :rtype:

(im, min_size=256, fill_color=(0, 0, 0, 0))

Source from the content-addressed store, hash-verified

48
49
50def make_square(im, min_size=256, fill_color=(0, 0, 0, 0)):
51 """
52
53 :param im:
54 :type im:
55 :param min_size:
56 :type min_size:
57 :param fill_color:
58 :type fill_color:
59 :return:
60 :rtype:
61 """
62
63 x, y = im.size
64 size = max(min_size, x, y)
65 new_im = PIL.Image.new('RGBA', (size, size), fill_color)
66 new_im.paste(im, (int((size - x) / 2), int((size - y) / 2)))
67 return new_im
68
69
70def convert_to_bytes(file_or_bytes, resize=None, fill=False):

Callers 1

convert_to_bytesFunction · 0.70

Calls 1

newMethod · 0.45

Tested by

no test coverage detected