Closed pudiva closed 10 years ago
This is not how PDF really works.
You can put in however big image (even 300 DPI ones) and set actual dimensions of it. Renderer (printer) would figure out how to scale it.
I thought Prawn was resampling my image, but after inspecting teh pdf with a text editor, I just realized that this is not true.
@ayghor: I'm guessing that you may have run into issues that made the image render poorly that are related to the fact that your image is in 300dpi but Prawn's measurements are all in 1/72 inch standard PDF points.
There is a ]really long thread on the mailing list](https://groups.google.com/forum/#!searchin/prawn-ruby/dpi/prawn-ruby/MbMsCx862iY/GmVqf0mEJjIJ) related to this topic, which may be helpful. I'm leaving this ticket open until you have a chance to let me know if that helps.
I don't remember the details of this issue, but I feel like there may be room for Prawn to help with the conversion between its default units and arbitrary DPI when specifying things like image dimensions.
Teh problem was with my pdf reader, xpdf. Firefox's renderer is displaying stuff nicely.
After looking at teh horrid output from xpdf, I thought Prawn was resampling my image, like ghostscript, to better fit into a specific medium. I was wrong. I extracted teh jpeg stream from a generated pdf file and diffed with teh original image, and they are equal.
As long as it doesn't mess with teh real resolution, teh choice of teh point size is just a matter of taste, and I would go for 1/72 in.
Okay, sounds like you were running up against a renderer error then. Thanks for getting back to me on this, I'll go ahead and close the ticket now.
Yup, prawn never messes with real resolution of the image. We just fit the pixels into the requested space on the page.
That does mean it's possible for users to embded an image with a low DPI without realising it though.
It'd be nice if we could find a way to tweak the API to guide users that need to embed images with a certain DPI, but I can't think of anything off the top of my head.
On 14 December 2013 08:08, ayghor notifications@github.com wrote:
Teh problem was with my pdf reader, xpdf. Firefox's renderer is displaying stuff nicely.
After looking at teh horrid output from xpdf, I thought Prawn was resampling my image, like ghostscript, to better fit into a specific medium. I was wrong. I extracted teh jpeg stream from a generated pdf file and diffed with teh original image, and they are equal.
As long as it doesn't mess with teh real resolution, teh choice of teh point size is just a matter of taste, and I would go for 1/72 in.
— Reply to this email directly or view it on GitHubhttps://github.com/prawnpdf/prawn/issues/598#issuecomment-30543710 .
@yob That was the vague idea I was hinting at, and was hoping @ayghor would have a suggestion.
Anyway, it's not like we don't have more pressing issues to deal with, but I'd still be interested in proposals.
It would be nice to add something like this to teh docs:
Prawn won't resample or reencode your images. If teh image must be at a certain resolution or quality, it should be resampled or reencoded beforehand.
Or even better:
Prawn won't resample or reencode your images. If teh image file size, resolution or quality needs to meet some requirement, it should be resampled or reencoded beforehand.
It would be VERY nice to have an option to set images resolution, so we could make quality pdfs.
Something like:
for adding a 300dpi image.
Thanks.