From 6c797b0f47e7b45d950c50a8ec66054421ab6dbc Mon Sep 17 00:00:00 2001 From: Robohash <401330+e1ven@users.noreply.github.com> Date: Fri, 4 Nov 2022 14:31:20 -0400 Subject: [PATCH] flatten after bgset --- robohash/robohash.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/robohash/robohash.py b/robohash/robohash.py index d31ade7..e63e617 100644 --- a/robohash/robohash.py +++ b/robohash/robohash.py @@ -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