[poppler] pdftoppm: resulting image dpi and/or size is unexpected

Adrian Johnson ajohnson at redneon.com
Tue May 8 01:45:54 PDT 2012


On 08/05/12 09:56, Albert Astals Cid wrote:
> El Dilluns, 7 de maig de 2012, a les 19:14:54, Carlos Fernandez va escriure:
>> Albert,
>>
>> Thanks for the quick reply.
> 
> Please don't answer me, answer to the list, there's no reason to keep the 
> discussion "hidden" to the rest of the world.
> 
>> I am reading the DPI and image dimensions from Preview on OS X.  It
>> reports the fractions DPI for the 2040x2640 image.  Is the DPI
>> information baked into the image as metadata?
> 
> No idea to be honest.

Yes, the DPI is stored in the image file. In the case of PNG it is
stored as a integer specifying the number of pixels per metre. The
difference you are seeing is the rounding error due to the conversion
from dots/inch to pixels/metre rounded to an integer. Your viewer is
then converting the rounded value back to dpi.

As pixels/metre is the only unit supported by the PNG standard there is
nothing poppler can do to avoid the rounding problem.


> 
>>>> using "-r 150" (or just relying on the default value of 150) to create
>>>> an image on a 8.5x11 inch pdf generates an image that is 1275 × 1651
>>>> pixels at 150dpi.
>>
>> Should this image be 1275x1650?
> 
> That might make sense.
> 
> Anyway this is a development list, if you are not planning to develop a fix 
> what you should do is open a bug in bugzilla, it is much easier to keep track 
> of the bugs in there.
> 
> Cheers,
>   Albert
> 
>>
>> Carlos
>>
>> On Mon, May 7, 2012 at 5:17 PM, Albert Astals Cid <aacid at kde.org> wrote:
>>> El Dilluns, 7 de maig de 2012, a les 16:58:27, Carlos Fernandez va 
> escriure:
>>>> trying to split a pdf into page images using pdftoppm.  I would like
>>>> the resulting images to maintain the same size and scale as the source
>>>> PDF.  unfortunately the images being generated are somewhat
>>>> unexpected.
>>>>
>>>> using "-r 150" (or just relying on the default value of 150) to create
>>>> an image on a 8.5x11 inch pdf generates an image that is 1275 × 1651
>>>> pixels at 150dpi.
>>>>
>>>> using "-r 240" to create an image on the same 8.5x11 inch pdf
>>>> generates an image that is 2040 x 2640 pixels at 239.97 dpi.
>>>
>>> Hmmm, really?
>>> 2040/8.5 = 240 not 239.97
>>> 2640/11 = 240 not 239.97
>>>
>>>> these results were consistent for png or tiff output.  I got similar
>>>> results for other dpi settings across a few different PDFs.
>>>>
>>>> What can i do to get more consistent results?
>>>
>>> What's inconsistent?
>>>
>>> Albert
>>>
>>>> Carlos
>>>> _______________________________________________
>>>> poppler mailing list
>>>> poppler at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>>
>>> _______________________________________________
>>> poppler mailing list
>>> poppler at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/poppler
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler



More information about the poppler mailing list