From 0b0c522f5bed3af035c1d676a9157348deebcd78 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 2 Jul 2023 16:38:35 +0100 Subject: [PATCH] Fix image combine issues --- combineImg/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/combineImg/__init__.py b/combineImg/__init__.py index f836831..ccd1ecc 100644 --- a/combineImg/__init__.py +++ b/combineImg/__init__.py @@ -55,7 +55,13 @@ def combineImages(imageArray, totalWidth, totalHeight,pad=True): # image generation is needed topImg = findImageWithMostPixels(imageArray) newImage = Image.new("RGBA", (totalWidth, totalHeight),(0, 0, 0, 0)) + thirdImg = None + if len(imageArray) == 3: + thirdImg = imageArray[2] + imageArray = imageArray[0:2] imageArray = scaleAllImagesToSameSize(imageArray,topImg.size[0],topImg.size[1],pad) + if thirdImg: # workaround to avoid scaling the third image twice + imageArray.append(thirdImg) if (len(imageArray) == 2): # if there are two images, combine them horizontally for image in imageArray: newImage.paste(image, (x, y))