Ubuntu – converting images to pdf without quality loss

convertmultimediapdf

I am converting images to PDFs. I use following command

convert page.jpg page.pdf

and then combine multiple PDFs generated accordingly by command

pdftk 1.pdf 2.pdf output result.pdf

but I noticed loss of quality in the resulting PDF. Is there some way that I can retain the quality of the PDF i. e. I want the same quality in PDF as in the image.

I am not sure if this convert command is using the imagemagick library. Is there any better solution? I have 100s of PDFs, so I have to do it via command line.

Best Answer

Although the author of the question specifies the need to use command line because of the high number of image files, I have to say that the comment made by Tom Brossman related to LibreOfficeWriter is the best answer to the question, because it includes the solution to a nasty problem (presented below) that may appear especially when dealing with many images.I stumbled upon this problem and tried a few options - from the Termial, using Gimp and such, and using the 'printing as file' feature, but have to conclude that the 'drag and drop'+'Export as PDF' in LibreOfficeWriter is the best, because:

1) you can already see before exporting images as pdfs if there are any differences between these images as they will appear in the final pdf. What I mean is that despite similar sizes in bytes and aspect ratio, when importing jpeg-s or png-s into a pdf, some pages may appear much smaller than the others, without any difference in quality in fact, but just because they seem to be 'focused' differently and displayed at a different scale. (I cannot understand the cause of this and welcome a comment that would enlighten me, I just stumbled into this when putting very similar images into a pdf file, as seen below.)

enter image description here

When looking at the images before converting them into a pdf, you cannot anticipate this error, but LibreOfficeWriter makes it visible and also very easy to correct: just grab the margin of the image, put it into the appropriate form into the page, and it will appear as such in the final pdf.

enter image description here

2) And, when exporting ('File'- 'Export as PDF...') you have several options that let you control the final quality/size of the pdf, which could be very useful if you need to send it by mail and still keep some image quality.

enter image description here