I had trouble finding a similar issue.
I am using Pillow (Python 3.5 on a MAC dev machine) to merge multiple images into a single long horizontal image.
The images are screengrabs saved as jpgs from Pyppeteer - that part works well, can open and see the image:
Below is the code I am using. The image_sets kwarg is essentially a list of dictionaries with a name of the image set and the set of saved images from the Pypetteer code, currently 2 sets for my dev code:
import sys
from PIL import Image
class ImageGenerator(object):
def __init__(self, **kwargs):
self.image_sets = kwargs['image_sets']
def generate_images(self):
for image_set in self.image_sets:
#create PIL images from the saved images
images = map(Image.open, image_set['generated'])
widths, heights = zip(*(i.size for i in images))
total_width = sum(widths)
max_height = max(heights)
new_im = Image.new('RGB', (total_width, max_height))
x_offset = 0
for im in images:
new_im.paste(im, (x_offset, 0))
x_offset += im.size[0]
new_im.save("output/{}.jpg".format(image_set['set_name']))
if __name__ == "__main__":
# NOTE - I removed code that was here, irrelevant to my question, but the
# output is the "creatd_images" dict which I pass to the PIL class
image_generator = ImageGenerator(image_sets=created_images)
image_generator.generate_images()
This all works well - no errors. It creates images of the proper size and everything. The issue is when I open them, the new stitched together images are all black.
I have tried this with PNGs as well, same issue (this original image is like 15000px wide and 1080p high).
Here's the result:

