Replies: 8 comments
-
The image extraction : in the content of the page a different scale factor is applied on X and Y :
this explains why the image is stretched when extracted but displayed differently in the pdf. |
Beta Was this translation helpful? Give feedback.
-
Ok @pubpub-zz how do I avoid this? I want to get the image with the correct width and height |
Beta Was this translation helpful? Give feedback.
-
There probably is no easy approach to avoid this for now, as the image and its extraction to not know the current transformation. This requires further processing of all transformations of the page until the image is inserted. |
Beta Was this translation helpful? Give feedback.
-
You may use the visitor function working to identify the cm matrix when the Do operator is detected |
Beta Was this translation helpful? Give feedback.
-
Could you please explain a bit deeper how to use it? I don't understand exactly why this is happening, the images should be loaded exactly as they are, am I righ? |
Beta Was this translation helpful? Give feedback.
-
(with a little of simplification)
No : the stored image can be different from the display. |
Beta Was this translation helpful? Give feedback.
-
Note, for the specific Image/PDF identified in the OP, the operation is pretty straightforward: the image is simply rotated 270 degrees and rescaled to the full page dimensions at display time. Wouldn't you just have to extracted_image.rotate(270)
extracted_image.resize((3508, 4961))
extracted_image.save("/output/path/extracted_image.jpg") where (3508, 4961) can be replaced with any tuple of integers that maintain the 'A' paper aspect ratio? Note: (3508, 4961) corresponds to 300 dpi for an A3 portrait page. (842, 1191) would correspond to 72 dpi for an A3 portrait page and appears to be more or less exactly what the |
Beta Was this translation helpful? Give feedback.
-
This is definitely not an issue. I convert this into a disccusion |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There are errors while reading images in pdf. As you can see in the following image. It looks like the image appears to have some distortion or stretching:
But as you can see in the pdf the original image doesn't look like that.
Environment
Which environment were you using when you encountered the problem?
Code + PDF
PDF:
This link
This is a minimal, complete example that shows the issue:
Beta Was this translation helpful? Give feedback.
All reactions