mirror of
https://github.com/e1ven/Robohash.git
synced 2025-06-23 21:35:02 +00:00
flatten after bgset
This commit is contained in:
parent
2a3fc56a09
commit
9df91231a9
@ -183,18 +183,18 @@ class Robohash(object):
|
|||||||
img = img.resize((1024,1024))
|
img = img.resize((1024,1024))
|
||||||
roboimg.paste(img,(0,0),img)
|
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:
|
if bgset is not None:
|
||||||
bg = Image.open(background)
|
bg = Image.open(background)
|
||||||
bg = bg.resize((1024,1024))
|
bg = bg.resize((1024,1024))
|
||||||
bg.paste(roboimg,(0,0),roboimg)
|
bg.paste(roboimg,(0,0),roboimg)
|
||||||
roboimg = bg
|
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.img = roboimg.resize((sizex,sizey),Image.ANTIALIAS)
|
||||||
self.format = format
|
self.format = format
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user