Code:
def make_square(im, min_size=0, fill_color=(206, 150, 106, 0)):
x, y = im.size
size = max(min_size, x, y)
new_im = Image.new('RGB', (size, size), fill_color)
new_im.paste(im, (float((size - x) / 2, (size - y) / 2)))
return new_im
then i got error :
TypeError Traceback (most recent call last)
<ipython-input-15-d7020999e20a> in <module>()
11 size = (30, 30)
12
---> 13 img = make_square(img)
14 img = img.resize(size, Image.ANTIALIAS)
15 matrix = np.array(img)
<ipython-input-14-8407033de8d8> in make_square(im, min_size, fill_color)
3 size = max(min_size, x, y)
4 new_im = Image.new('RGB', (size, size), fill_color)
----> 5 new_im.paste(im, (float((size - x) / 2, (size - y) / 2)))
6 return new_im
help me please..
Comment