Hi everyone,
I need to convert a large number of images from bitmap format (JPEG, PNG) to PDF. I read the documentation but did not find an answer to my questions. These are:
1. When converting JPEGs, is it guaranteed that the quality of the PDF will be no worse than the JPEG? Specifically, when converting a JPEG image to PDF, will the JPEG stream by re-encoded by ImageMagick or will ImageMagick just put the original JPEG DCT byte stream into the PDF without changing it?
2. When converting PNGs or other losless formats, which encoding will ImageMagick use? Is there a risk that it uses DCTEncoding for some images, thus re-encoding the losless PNG into a lossy JPEG stream? Or will it just use ZIP or RLE encoding in the PDF always?
3. Will ImageMagick keep the colors as is when just using "convert test.jpg test.pdf"? Specifically, will it always embedd the ICC profile found in the original bitmap file?
Any insight greatly appreciated.
Best regards,
Markus
Quality when converting bitmaps to PDF format
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: Quality when converting bitmaps to PDF format
Well, at least I can answer your question number 1: As IM uses its own proprietary format as an intermediate format, the JPEGs will be re-encoded and you will loose some quality. I am even not sure whether the JPEG quality will be preserved in this operation (as it usually is by IM when converting from JPEG to JPEG).
If you want to just wrap the JPEG files in a PDF, there is special (free) software that performs this trick. Which software depends on the plattform you are using.
If you want to just wrap the JPEG files in a PDF, there is special (free) software that performs this trick. Which software depends on the plattform you are using.
Wolfgang Hugemann
Re: Quality when converting bitmaps to PDF format
Wolfgang,
thanks for the answer, that makes sense.
Which software would you recommend for the task at hand? I have been using iText in the past for conversion (with a few lines of Java code) but a drawback of iText is that it does not support all image file formats ImageMagick supports (and even for those it pretends to support it has some annoying limitations).
Thanks,
Markus
thanks for the answer, that makes sense.
Which software would you recommend for the task at hand? I have been using iText in the past for conversion (with a few lines of Java code) but a drawback of iText is that it does not support all image file formats ImageMagick supports (and even for those it pretends to support it has some annoying limitations).
Thanks,
Markus
Re: Quality when converting bitmaps to PDF format
Aaaah, BTW I am using Linux 

- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: Quality when converting bitmaps to PDF format
Being a Windows user, I use JPEGtoPDF http://www.compulsivecode.com/Project_ImageToPDF.aspx, which is written in VB.NET, i.e. you would need a .NET interpreter such as Mono. Another approach would be via a (La)TeX compiler like PDFtex, which does the trick too. This would however require some knowledge in LaTeX an a little code.
I could imagine that you could even write some basic conversion code yourself, as JPEGs are wraped in PDFs as streams (i.e. exact blob copies) with minimal overhead. So it should be comparably easy to place each JPEG on a separate PDF page.
I could imagine that you could even write some basic conversion code yourself, as JPEGs are wraped in PDFs as streams (i.e. exact blob copies) with minimal overhead. So it should be comparably easy to place each JPEG on a separate PDF page.
Wolfgang Hugemann