from PIL import Image import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() images_length = int(input('Please input number of images:')) images = [] for i in range(images_length): path = filedialog.askopenfilename() image = Image.open(path) images.append(image.convert('RGB')) image1 = images[0] images = images[1:len(images)] image1.save(r'output.pdf',save_all=True, append_images=images)