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.
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.)
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.
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.
I dont know if this is definitely the answer to your question as i am not used to the convert program. PDF is not an image file format, its is a way of formatting documents so that they can be represented consistently not matter what hardware/software you are viewing it from. Therefore when you "convert" the image from JPEG to PDF the JPEG is not actually being converted. The JPEG is embedded in the PDF file itself and the PDF file tells your document viewer how to display the contents on the screen/page.
I imagine the loss of quality you are seeing is because of the program with which you are viewing the files. When you view the jpeg with GNOME image viewer the image is displayed exactly as it should be, say and 800x600px image is layout out perfectly on 800x600 pixels on the screen. But when you open your PDF in Document Viewer the viewer lays the 800x600px image out over maybe 25x15cm (or whatever) of the document which when viewed at 100% may not be exactly 800x600 pixels of screen space, it may be more therefore stretching the image and reducing the quality.
Based on your comment I tried the links and I see what the problem is. You issue is with the heavy compression that Issuu applies to the pages, and with the Flash interface used to display the page as a lossy image.
Your conversion of images to PDF is just fine, the quality loss is occurring when Issuu converts your PDF to their proprietary Flash format and serves it up on the site.
I have used https://pic2pdf.net in order to convert jpeg files to pdf without quality loss and attached to word file. It may workout for this situation.