Skip to content

Commit 0b0c522

Browse files
committed
Fix image combine issues
1 parent 14bc95b commit 0b0c522

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

combineImg/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def combineImages(imageArray, totalWidth, totalHeight,pad=True):
5555
# image generation is needed
5656
topImg = findImageWithMostPixels(imageArray)
5757
newImage = Image.new("RGBA", (totalWidth, totalHeight),(0, 0, 0, 0))
58+
thirdImg = None
59+
if len(imageArray) == 3:
60+
thirdImg = imageArray[2]
61+
imageArray = imageArray[0:2]
5862
imageArray = scaleAllImagesToSameSize(imageArray,topImg.size[0],topImg.size[1],pad)
63+
if thirdImg: # workaround to avoid scaling the third image twice
64+
imageArray.append(thirdImg)
5965
if (len(imageArray) == 2): # if there are two images, combine them horizontally
6066
for image in imageArray:
6167
newImage.paste(image, (x, y))

0 commit comments

Comments
 (0)