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

Function make_square

DemoPrograms/Demo_PIL_Use.py:21–26  ·  view source on GitHub ↗
(im,  fill_color=(0, 0, 0, 0))

Source from the content-addressed store, hash-verified

19"""
20
21def make_square(im, fill_color=(0, 0, 0, 0)):
22 x, y = im.size
23 size = max(x, y)
24 new_im = Image.new('RGBA', (size, size), fill_color)
25 new_im.paste(im, (int((size - x) / 2), int((size - y) / 2)))
26 return new_im
27
28
29

Callers 1

convert_to_bytesFunction · 0.70

Calls 1

newMethod · 0.45

Tested by

no test coverage detected