Bug 45224 - pdftoppm-exported JPEGs should retain ppi info
Summary: pdftoppm-exported JPEGs should retain ppi info
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: utils (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Mac OS X (All)
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-25 03:42 UTC by Jorge Hernández Valiñani
Modified: 2012-01-26 14:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch to fix (1.68 KB, patch)
2012-01-25 04:29 UTC, Adrian Johnson
Details | Splinter Review

Description Jorge Hernández Valiñani 2012-01-25 03:42:40 UTC
When converting a PDF to JPEG using a custom resolution like in the command below:

	pdftoppm -jpeg -r 214 in.pdf out

the output JPEG does not seem to contain any ppi info (and hence defaults to 72 in most graphic apps). It should retain the custom ppi used in the command to generate it, just like tiff files do with the command:

	pdftoppm -tiff -r 214 in.pdf out

Using Macports' pdftoppm version 0.18.2 from the port poppler @0.18.2 (graphics/poppler)
Comment 1 Adrian Johnson 2012-01-25 04:29:45 UTC
Created attachment 56136 [details] [review]
patch to fix

Problem is caused by calling jpeg_set_defaults(&cinfo) after setting the resolution which overwrites the resolution.
Comment 2 Albert Astals Cid 2012-01-26 09:46:40 UTC
Adrian, should the
 cinfo.in_color_space = colorMode; /* colorspace of input image */
also be after 
 jpeg_set_defaults(&cinfo);
?
Comment 3 Adrian Johnson 2012-01-26 12:55:17 UTC
(In reply to comment #2)
> Adrian, should the
>  cinfo.in_color_space = colorMode; /* colorspace of input image */
> also be after 
>  jpeg_set_defaults(&cinfo);
> ?

No. The libjpeg documentation for jpeg_set_defaults() states:

  "This routine sets all JPEG parameters to reasonable defaults, using
   only the input image's color space (field in_color_space, which must
   already be set in cinfo)"
Comment 4 Albert Astals Cid 2012-01-26 13:44:51 UTC
Makes sense then, please commit :-)
Comment 5 Adrian Johnson 2012-01-26 14:26:42 UTC
Committed.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.