Drop in quality after convert

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
0106xzh
Posts: 2
Joined: 2014-07-07T05:23:05-07:00
Authentication code: 6789

Drop in quality after convert

Post by 0106xzh »

Hi!
I use the command
convert -quality 100 2.pdf 2.jpg
and it works fine, only that the quality is significantly reduced in the output image. How can I preserve pristine image quality when converting?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Drop in quality after convert

Post by snibgo »

You probably need "-density", eg:

Code: Select all

convert -density 300 2.pdf -quality 100 2.jpg
snibgo's IM pages: im.snibgo.com
ronco
Posts: 2
Joined: 2014-06-28T22:48:55-07:00
Authentication code: 6789
Contact:

Re: Drop in quality after convert

Post by ronco »

I had the same problem. It worked in my case, thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Drop in quality after convert

Post by anthony »

JPG is a lossy image file format. and I mean lossy in that you do not get exactly the same colors you put into it.


100% quality is not 100% no-change. It just increases the resolution of the way the JPG is compressed and thus improve quality to the maximum that the jpg algorithm can preserve. It is still lossy however

JPEG v2 (jp2 or jpg2000) does have a lossless mode to it, but that is not the jpeg everyone knows, and is avived by using a different (lossless) compression such as PNG uses.

Simply put.. The act of saving to JPEG format -- looses image quality!
So if you don't want the loss of quality... do not use JPEG.

See... JPEG
http://www.imagemagick.org/Usage/formats/#jpg

Or.... Jpeg Compression Introduction
http://www.photo.net/learn/jpeg/


The other aspect is the source image file formal... PDF.. this is a vector image format that may or may not contain some raster images. raster images has a associated denisty (pixels per inch or centimeter), but vector images (such as text in the PDF) do not.

To get the BEST quality image out of a PDF you need to use the exact density the PDF was designed for. Typically either 300 dpi or 600 dpi (for printers) but not always.

It gets worse in that raster images inside a PDF may not be sized for a specific resolution, but sized to fit an area of the page. As such multiple images in the PDF may have different 'ideal densities'.


Really getting high quality from a raster image embedded in a PDF (or postscript for that matter) file format is tricky and difficult. I have yet to find a good tool for perfect extraction of images from PDF files, though I am sure it is posible.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
0106xzh
Posts: 2
Joined: 2014-07-07T05:23:05-07:00
Authentication code: 6789

Re: Drop in quality after convert

Post by 0106xzh »

Ty for the help, the density helped, but my overall goal is not even a JPG conversion, but to create video out of ebooks. As far as I know, the best way to do that is to convert PDF to image and then use a video editor. Is there a better way to turn PDF/epub to vid?
Post Reply