converting images to pdf without quality loss

14,963

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.

Share:
14,963

Related videos on Youtube

Registered User
Author by

Registered User

Updated on September 18, 2022

Comments

  • Registered User
    Registered User over 1 year

    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.

    • Admin
      Admin over 12 years
      I've always dragged images into a blank LibreOffice Writer page, then exported the page as a PDF. Can you try this and see if this gives you the result you want?
    • Admin
      Admin over 12 years
      I think you need to add the -quality switch to the convert command? I don't think pdftk does any resampling on its own. I.e. convert page.jpg -quality 100 page.pdf
    • Admin
      Admin over 12 years
      Another way is to install a pdf printer and print it to this one.
    • Admin
      Admin over 12 years
      I don't have this issue with convert, or I don't notice it. Could you explain in detail the loss of quality or provide an example?
    • Admin
      Admin over 12 years
      @steabert check install cups-pdf in your machine. Now check this link futuresamachar.com/index.php?url=view/2007/February and via the web interface go to page 13 take a printout of as a pdf as softcopy.Now go to this link image.issuu.com/110829052101-b15e7acd36244915b721c47cc572dab‌​2/jpg/page_13.jpg and use your convert method.You will notice the difference.
    • Admin
      Admin over 12 years
      First of all, you are comparing a pdf generated from a website with a pdf generated from a jpg that you give. In any case, I found no difference. Printing to pdf with cups-pdf and then extracting the images with pdfimages -j, the main one is a 1142x1500 jpg, larger in size but same resolution as the jpg you provided. On the other hand, converting the jpg you provide to pdf with convert and then extracting to jpg again yields the original jpg, so how can there have been quality loss?
    • Admin
      Admin over 12 years
      @steabert no if you notice the pdf from the web interface if taken print out letters have more sharpness than the pdf which is generated with convert -quality 100file.jpg file.pdf ok the size of pdf from web interface is 600 K and the pdf generated from convert is 400 K so this might give some clue.
    • Admin
      Admin over 12 years
      You are comparing two different things, why do you assume the pdf printed from the webpage should have the same quality as the pdf you generate from your jpg? So, I guess the question is how do you obtain that jpg in the first place?
    • Admin
      Admin over 12 years
      Hmmm I dont think that they will have same quality.I want to know what is different in those two? Why is there a difference and what exactly is that variation?
    • Admin
      Admin over 12 years
      The pdf you print from the flash interface has the characters of the main text in vector format, that is the characters are stored by mathematical equations so that they render perfectly. The jpg image is a bitmap and cannot provide this, it would need much larger resolution for you not to notice a quality difference, e.g. something like 600dpi for print.
    • Admin
      Admin over 7 years
      When you open your pdf, ensure your zoom is 100 %; else you will see distortions.
  • Registered User
    Registered User over 12 years
    infact the flash interface which they are using if you take a printout from it gives a pdf worth 600 K and if you take a printout of image via convert is 400K.What you said I had understood.The quality of pdf generated via their viewer is better than the one I have by converting the image to pdf using imagemagick.But is there a way out there so that I retain the quality of pdf.
  • Gaurav Bindal
    Gaurav Bindal over 12 years
    Now I think I get your problem. Yes the printed pdf from the flash interface has the characters in vector format. But I still don't know what's the deal with the jpg image, what exactly are you trying to do??
  • Registered User
    Registered User over 12 years
    @steabert I am just trying to understand image manipulation tools a bit better.How does one get to know various parameters like dpi,density or other things of a pdf or jpg and then compare them with different conversion programmes.I am trying to compare different programmes as how effective different programmes are.A comparison of properietary and open source tools kind of study.Where do these difference come in etc etc.
  • Nmath
    Nmath over 3 years
    This website doesn't even have a privacy policy. I wouldn't use this website for anything that contains any kind of personal or identifying information or trade secrets.