Skip to content

Commit

Permalink
flatten after bgset
Browse files Browse the repository at this point in the history
  • Loading branch information
Robohash committed Nov 4, 2022
1 parent 2a3fc56 commit 9df9123
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions robohash/robohash.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ def assemble(self,roboset=None,color=None,format=None,bgset=None,sizex=300,sizey
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

0 comments on commit 9df9123

Please sign in to comment.