using this py code
import fitz
# Open the PDF file
file = fitz.open("D41813 LS K2W COLLAR TOP 000751556 (0318).pdf")
# Iterate through each page of the PDF
for pageNumber, page in enumerate(file, start=1):
# Get the list of images on the current page
for imgNumber, img in enumerate(page.get_images(full=True), start=1):
xref = img[0]
# Extract the image
pix = fitz.Pixmap(file, xref)
# Convert the image to RGB if it is not already in that format
if pix.n > 4 or pix.alpha: # Check if the image is CMYK or has alpha channel
pix = fitz.Pixmap(fitz.csRGB, pix)
# Save the image with a unique filename
pix.save(f"page{pageNumber}_img{imgNumber}.jpg")
# Close the PDF file
file.close()
to extract images from the pdf getting some images and missing some images from this page and not able to get all the images from this page and some images are extracted to 1 x 1 dimension.
so help me extract images as it is in the pdf, used pdfmupdf but i didn’t got any good with this package images extracted are dark in color.