Convert PNG or JPEG into PDF without reencoding

2

I have a JPEG (or PNG) image file and I want to create a PDF that contains this image without any quality loss. Just a one-page PDF document with that image. Is there an easy solution for this?

I know that pdflatex can embed JPEG or PNG images directly into the document but I'd like to avoid creating a .tex file, although this solution seems to be working: How to convert a png into pdf using LaTeX?.

As far is I know convert always reencodes the image, so that is not the answer I'm looking for.

Csq

Posted 2017-03-20T21:41:25.183

Reputation: 147

I'm not sure lossless is possible for an arbitrarily large image. – wogsland – 2017-03-20T22:09:00.717

@wogsland, i think the question is not about using lossless encoding, but about avoiding reencoding already encoded image. – Alexey – 2017-03-20T22:15:14.637

1

I can't personally vouch for how well it works, put apparently http://stackoverflow.com/a/16325916/6047952 refers to a program called img2pdf that wraps a jpg into a pdf without re-encoding

– infixed – 2017-03-20T22:28:19.157

My understanding is that the PDF is more of a wrapper for the image than a re-encoding or conversion. I'm not familiar with whether the PDF spec defines limitations on embedded image characteristics (requiring re-encoding for compliance), but I believe any optimization is a "feature" of whatever is creating the PDF. – fixer1234 – 2017-03-20T22:30:32.610

Answers

1

(Stumbling upon my own question half year later again.)

The img2pdf tool recommended by by infixed in the comments above works perfectly. It is a bit cumbersome to install Python, install a pip package and run the script, but I managed to get it work even under Windows eventually.

Csq

Posted 2017-03-20T21:41:25.183

Reputation: 147

0

You can use Images2PDF, made by the same people that sell PDFCreator. The current version is paid but you can find the last free version (0.9.7) in other sites like Softpedia. I've been using it for a long time when converting some scanned or Photoshop-rendered images to PDF for easier visualization on mobile and web. This is the official site: PDFforge's site for the latest version of Images2PDF. This is the window where you can set the compression for the images you're working on: Image compression settings. Hope this helps.

letinmore

Posted 2017-03-20T21:41:25.183

Reputation: 1