I am using texmaker and is writing a thesis where I have many different images. These images needs to have a pixel perfect accuracy so the results are not incorrect. I have many png images I would like to use. How is the images stored or compressed upon building into a pdf-file? How can I change such method in the event of my conversion being incorrect?


For bitmap images (such as png) the files are copied as-is (and there is no way to change them in any way) and wrapped in a PDF object. Compression is done on-top as for other objects in a PDF file with the usual losless file compression of PDF. This is true for pdftex and xetex and probably still true for luatex.


The closest answer I found to this question was through this: https://tug.org/TUGboat/tb26-1/hoeppner.pdf

It does not explicitly state what I was asking but it says that PNG is supported through pdflatex. Read it for further details for your own specific problem.


After generating the pdf, you can use ghostscript to compress the images. Ex:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH -dEmbedAllFonts=true -dSubsetFonts=true -dDetectDuplicateImages -dPDFSETTINGS=/prepress -sOutputFile=${DOC}-compress.pdf ${DOC}.pdf

After that I use exiftool to maintain tags. Ex:

exiftool -overwrite_original -all= -tagsFromFile ${DOC}.pdf ${DOC}-compress.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.