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

Function make_square

DemoPrograms/Demo_Image_Viewer_Thumbnails.py:29–34  ·  view source on GitHub ↗
(im, min_size=256, fill_color=(0, 0, 0, 0))

Source from the content-addressed store, hash-verified

27
28
29def 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
37def 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