I have installed PymuPDF/fitz because am trying to extract images from PDF files. However, upon running the code below, I am seeing No module named 'frontend'
.
doc = fitz.open(pdf_path) for i in range(len(doc)): for img in doc.getPageImageList(i): xref = img[0] pix = fitz.Pixmap(doc, xref) if pix.n < 5: # this is GRAY or RGB pix.writePNG("p%s-%s.png" % (i, xref)) else: # CMYK: convert to RGB first pix1 = fitz.Pixmap(fitz.csRGB, pix) pix1.writePNG("p%s-%s.png" % (i, xref)) pix1 = None pix = None
I have searched but there isn't single report of this kind of error. I have installed PyMuPDF, muPDF and fitz modules
Here is the error in full:
Traceback (most recent call last): File "/home/waqar/PycharmProjects/predator/ExtractFileImage.py", line 1, in <module> import fitz File "/home/waqar/anaconda3/envs/retinanet/lib/python3.6/site-packages/fitz/__init__.py", line 1, in <module> from frontend import * ModuleNotFoundError: No module named 'frontend'
I've solved it by:
pip install PyMuPDF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With