flatten after bgset

This commit is contained in:
Robohash 2022-11-04 14:31:20 -04:00
parent 8cd881354f
commit 6c797b0f47

View File

@ -183,18 +183,18 @@ class Robohash(object):
img = img.resize((1024,1024))
roboimg.paste(img,(0,0),img)
# If we're a BMP, flatten the image.
if format == 'bmp':
#Flatten bmps
r, g, b, a = roboimg.split()
roboimg = Image.merge("RGB", (r, g, b))
if bgset is not None:
bg = Image.open(background)
bg = bg.resize((1024,1024))
bg.paste(roboimg,(0,0),roboimg)
roboimg = bg
# If we're a BMP, flatten the image.
if format in ['bmp','jpeg']:
#Flatten bmps
r, g, b, a = roboimg.split()
roboimg = Image.merge("RGB", (r, g, b))
self.img = roboimg.resize((sizex,sizey),Image.ANTIALIAS)
self.format = format