def combineResults(args, thread_count, palette_data): thread_id = args[0] combine_input_image = args[1] x_start = args[2] x_end = args[3] inputs = [] for thread_a in range(0, thread_count): input_thread = outputFolder + 'temp/' + str(combine_input_image[1]) + '_' + str(thread_a) + "_8bpp.png" inputs.append(input_thread) image_for_resolution = Image.open(inputs[0]) combined_image = Image.new("RGBA", (image_for_resolution.width, image_for_resolution.height), color =(0,0,255,255)) for input_image_path in inputs: image_to_add = Image.open(input_image_path) combined_image = Image.alpha_composite(combined_image, image_to_add) final_image = Image.new("L", (image_for_resolution.width, image_for_resolution.height), 0) final_image.paste(combined_image, box=None, mask=None) final_image.putpalette(palette_data) final_image.save(outputFolder + str(combine_input_image[1]) + "_8bpp_combined.png")