PDF Image dpi
Most elements of a PDF file are device independent Vector graphics. This means that they will always appear ‘smooth and clear’. By contrast images are bit-mapped. If the image is stretched it can appear pixellated. If the image is too small, it will be stretched and the pixels will become blocky. This happens when the image is of a low resolution.
There is a tradeoff here. The better quality, the bigger it (and the PDF) will be. That is why most PDF creation tools allow you to specify whether you are producing files for screen or printing. Printing benefits from better images but this means bigger files.
What you actually have with a PDF file is a raw image and a ‘scaling’ command to fit it into a slot on the page (the CTM matrix). If the raw image is bigger than the ‘slot’ you can zoom into the page and print it at high resolution. But there drawbacks. We saw a very large PDF file with raw images of 26,000 x 26,000 pixels which is rather excessive!
Combining the raw image size and the CTM does actually allow you to work out the image quality to decide how well the PDF file will scale and fit. Let me show you with an example. Imagine we have an image which is 585×585 pixels. It is shown on page with this CTM value.
(843 0 0)
(0 843 0)
(x y 1)
We can work out the dpi value with this formula
This gives us a value of 69. This is reasonable for screen display (where 72 is the target figure) but not great for printing or for fine zooming. For printing, 300+ dpi should be the target.
We have added dpi calculations into our PDF viewer so you can get JPedal to do all the hard work of calculating the dpi with the 20th December release.
This post is part of our “Understanding the PDF File Format” series. In each article, we aim to take a specific PDF feature and explain it in simple terms. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!
Latest posts by Mark Stephens (see all)
- Introducing the new XFA Parser in FormVu - May 16, 2018
- Moving to JPedal release 8 - May 2, 2018
- Which version of Java SE should I use? - April 25, 2018
- How we are improving our code quality with IDEA in 2018 - March 7, 2018
- How we are improving our code quality with NetBeans in 2018 - March 1, 2018