I have an image embedded in a PDF file. I was able to extract the resolution of the image. However, if i crop the PDF using iTextsharp and a part of the image is cropped in the process. The new image continues to have the same resolution. By resolution I mean the dimension in the form of Width x Height. The cropped image is supposed to have a smaller size. How can I extract the size of the image in inches, if possible, so that I can differentiate the original image from the cropped pdf?
Share
Embedded images in PDFs are never “cropped” in the sense that the “cropped-away” parts are gone forever. They are only cropped in the sense that these parts are hidden or masked.
If the image data inside the PDF say
/Height 216and/Width 288then this is the size in Pixels (not inches or any other length unit). And “resolution” is then secondary:if the PDF environment commands that this image should be rendered onto a square of 3×4 inches, its resolution in this moment is 72×72 dpi.
if the PDF environment commands that this image should be rendered onto a square of 1.5×2 inches, its resolution in this moment is 144×144 dpi.
However it can well be that the image is only partially visible (“cropped”), maybe because half of it is rendering beyond the page borders…