New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
page.images is empty #449
Comments
I think the image is nested in a Form XObject, which is not handled by the |
Thanks @mara004 What is the correct way to access all images in a document. from pikepdf import Pdf, PdfImage, Name
doc = Pdf.open('test.pdf')
for object in doc.objects:
print('object')
if getattr(object, "Type", None) == "/XObject" and getattr(object, "Subtype", None) == "/Image":
print('image') But getting an error:
|
@mara004 according to this issue mozilla/pdf.js#16073 (comment) 16 0 obj is an image with huge dimensions. Is this image invisible? |
There have been various reports about images nested in XObjects in the past. Maybe see #423 (comment) |
According to PDFium, your actual image is 2x2 pixels, i. e. extremely small (though it is displayed differently).
|
And this is the rendered image (again using PDFium for my simplicity):
|
This is what I'm getting when using _find_images(page) from #423 (comment)
|
Ah, the image are the three arrows, right? Then it's actually visible. I was confused by the coordinates, but it makes sense if they're relative to the Form XObject. |
Is there a way to detect large images and resize them? What should I check in the images returned from _find_images()? |
What do you mean by resizing? Making the image visually smaller, or downsampling it? |
In either case, see https://pikepdf.readthedocs.io/en/latest/topics/images.html#replacing-an-image |
How do I create a PdfImage from the list returned from find_images in #423 (comment)? |
Just PdfImage(raw_image) I suppose |
Thanks, I'll try to downsample and replace the images. |
I have the same issue in different PDF files, where find_images from #423 finds more images than page.images. example_120.pdf example_043.pdf (external link because of the size limit) example_063.pdf |
I'm trying to resize only images with large resolution in a document. I've been told that the attached document has such images.
page.images doesn't show me any image. Am I doing something wrong?
test.pdf
The text was updated successfully, but these errors were encountered: