Isolating whether elements are from the output PDF file or PDF reader being used #162
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First of all thanks for all the work. I'm hoping to get a reading experience as similar when opening the original images as to opening the PDF, but I'm having some difficulties:
Upon conversion, by way of
img2pdf --viewer-fullscreen "$@" -o "${filename}.pdf"
the result seems to not be lossless: the quality is blurrier, the colors change, the dimensions are slightly warped, and the reader seems to think the PDF is way bigger than the images used were. I'm wondering if this is because the conversion to the PDF file itself failed, or because there are issues with the PDF reader I'm using.You did not show evidence that img2pdf is not lossless. The effect you see can be explained by your pdf viewer doing bicubic scaling when zooming in instead of showing you very large pixels.
If you think there are a bunch of issues, please file one issue for each issue you see. Otherwise it quickly becomes very messy.
I'm going to treat this issue as "img2pdf is not lossless".
Let me show you that img2pdf is indeed lossless on your input:
The original file and the file extracted from the pdf are bit-by-bit identical.
Also notice, that your first image
original.png
has an embedded color profile. Make sure that all viewer applications that you use are able to make use of this color profile. Applications that are unable to handle color profiles embedded in PNG files will obviously render the colors differently. But that again is not a bug in img2pdf.Thanks. It can be hard to visualize the purity since various readers apply different models as you explain, I'm learning of this recently and have edited the issue accordingly. I'll take it that the image is the same from your comparison. What about the scaling issue? Is there some metadata on the PDF telling apps how big it is? I've tried Preview, Acrobat Reader, and Chrome, they all seem to think the output PDF is made of really huge images.
Overall not losslessto Isolating whether elements are from the output PDF file or PDF reader being usedYes. Your
original.png
includes the information that the image has 72 dpi and that information is embededd into the resulting PDF. If you want to ignore the information in your input file, you can manually force a dpi setting using--dpi
or manually set a pdf page size using the-S
option. Refer to the--help
output for more information.Great! One thing though, I'm getting the output bellow and there's no mention of the command on
--help
.This output is automatically generated. The
-h
option is the short form of--help
. Try running it with--help
and you'll see it works as expected.And sorry, there is indeed no
--dpi
option. Instead you can set the image size in dpi by specifying:-s 999dpi
or--imgsize 999dpi
.Have a look at the output of
img2pdf -h
orimg2pdf --help
for more information.That works great. Thank you a lot with all the help and the script.