Page 1 of 1
'convert' produces bad quality since update to Ubuntu 12.04
Posted: 2012-04-17T04:20:46-07:00
by Mountain_Geek
I have recently updated from Ubuntu 11.10 to Ubuntu 12.04. Since then, a 'convert' script which I have used for years suddenly started producing worse quality (jagged edges, no dithering anymore?).
Here's the script:
convert -density 150 '/path/file.pdf' -colorspace Gray -strip -quality 85 '/path/file.jpg'
Here's how the resulting jpg used to look before:
And here's how it looks now:
Version: ImageMagick 6.6.9-7
Any ideas?
Thanks in advance!
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-17T06:49:00-07:00
by glennrp
Your images aren't visible (just the word "Image" appears in your message).
Can you post them (along with the pdf) on a web page somewhere?
Were you using the same ImageMagick version before? If so the difference
is probably in your PDF decoder or possibly in the JPEG encoder.
What happens if you convert to a lossless format such as PPM? If it
looks the same, that would say the JPEG encoder isn't to blame.
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-17T08:15:38-07:00
by Mountain_Geek
Thx for your reply:
glennrp wrote:Your images aren't visible (just the word "Image" appears in your message).
Can you post them (along with the pdf) on a web page somewhere?
OK, the jpgs should be visible now. Posting the pdf file is useless: it happens with all pdf files regardless of the source.
glennrp wrote:Were you using the same ImageMagick version before? If so the difference
is probably in your PDF decoder or possibly in the JPEG encoder.
Good question: might be that the new Ubuntu release has automatically updated the ImageMagick version as well.
glennrp wrote:What happens if you convert to a lossless format such as PPM? If it
looks the same, that would say the JPEG encoder isn't to blame.
The ppms look crappy, too.
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-24T16:43:13-07:00
by NicolasRobidoux
By "updated", do you mean that you did not do a clean reinstall? Despite the best intentions of the the Ubuntu devs, me and my grad students have not found this to be a 100% pain-free way of moving to a more recent version of Ubuntu. (No clue if this applies to 12.04 from, I hope, a fully updated 11.10. We're still with Ubuntu 11.10/Mint 12.)
ImageMagick has a particular long and complex list of delegate libraries. For this reason, it, of all things, is likely to break when updating instead of doing a full install when changing major version of any OS.
I am far from sure that this is what's going on. But I figured you should know.
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-24T17:34:02-07:00
by magick
Add -flatten to your command line:
- convert -density 150 -colorspace gray '/path/file.pdf' -flatten -quality 85 '/path/file.jpg'
or even better:
- convert -density 600 -colorspace gray '/path/file.pdf' -flatten -resize 25% -quality 92 '/path/file.jpg'
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-25T01:40:12-07:00
by Mountain_Geek
convert -density 150 -colorspace gray '/path/file.pdf' -flatten -quality 85 '/path/file.jpg'
Thanks: The "flatten" parameter somehow drastically improves the quality of text on white background (which was the major issue)!
The second suggestion produces even better quality, however the decoding at higher resolution and then resizing takes quite a while and it is not really worth the extra time and file space...
BUT: I usually convert a number of pdf files at the same time and the expected result are
separate jpg files. The "flatten" parameter, however, layers them all onto a single page! Is there a way around that?
Cheers!
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-25T01:43:02-07:00
by Mountain_Geek
NicolasRobidoux wrote:By "updated", do you mean that you did not do a clean reinstall? Despite the best intentions of the the Ubuntu devs, me and my grad students have not found this to be a 100% pain-free way of moving to a more recent version of Ubuntu. (No clue if this applies to 12.04 from, I hope, a fully updated 11.10. We're still with Ubuntu 11.10/Mint 12.)
ImageMagick has a particular long and complex list of delegate libraries. For this reason, it, of all things, is likely to break when updating instead of doing a full install when changing major version of any OS.
I am far from sure that this is what's going on. But I figured you should know.
You are only too right, but every approach has its downturns. A clean install involves about as much work getting back to where you were before (in terms of all the little tweaks that accumulate over the years) as an update requires patching around...
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-25T03:43:21-07:00
by NicolasRobidoux
With text, use PNG. With pngcrush if you want to squeeze out every little bit. Make sure you get a PNG8 out of this, and strip.
JPEG is very ill-suited for text.
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-26T01:53:17-07:00
by Mountain_Geek
NicolasRobidoux wrote:With text, use PNG. With pngcrush if you want to squeeze out every little bit. Make sure you get a PNG8 out of this, and strip.
JPEG is very ill-suited for text.
The converted files are subsequently used in an accounting software which can handle jpgs only...
Re: 'convert' produces bad quality since update to Ubuntu 12
Posted: 2012-04-26T03:01:02-07:00
by Mountain_Geek
OK, I have finally figured out what helps: I have added -bordercolor white -border 0 -alpha off to the command line and there we go: fine result!