I am pulling out embedded images from pdf pages using PyMuPDF / Fitz. This works great but some pdf files, but for certain ones the image is rotated 90 deg. I don't see any condition that could be used to correct this. Has anyone experienced this? Anyone have a solution?
I always appreciate the help!
for img in doc.getPageImageList(i):
xref = img[0]
pix = doc.extractImage(xref)
self.imagefilename = ("p%s-%s." % (i, xref)) + pix["ext"]
imgout = open(self.imagefilename, 'wb')
imgout.write(pix["image"])
imgout.close()