A total of 600 images took 100 seconds, and the generated file size was 150MB. I think it's too slow, the main reason add_picture. Can add_picture be executed in parallel? Generate multiple docx in parallel and finally merge it together? import time, os from docx import Document from docx.shared import Inches doc = Document() paths = ['uploads/file_path/1700000000/' + x for x in os.listdir('uploads/file_path/1700000000') if x.endswith('png')] at = time.time() for i, p in enumerate(paths): doc.add_heading(str(i), level=1) doc.add_picture(p, width=Inches(5.12)) doc.save('D:\\Users\\User\Desktop\\1.docx') print(time.time() - at) Continue reading...