1

I am trying to upload and convert pdf to jpeg image, i am using ghostscript with imagick and php. the problem is the quality of jpeg is not really satisfying.

this is my settings and what i use

exec('convert -density 400 -colorspace sRGB "'.$pdf_path.'[0]" -resize 842 -quality 100 "'.$save_path.'.jpg"');

which settings should i use?

as you can see the pictures are dark, the text is not clear. this is the url of the original pdf " http://icebergfeeds.co.uk/admin/images/magazine-content/54085a9d5a03d.pdf" and here is the example result , enter image description here

Display name
  • 420
  • 5
  • 20
  • http://icebergfeeds.co.uk/admin/images/magazine-content/540736661ba41.pdf Error 404 – KenS Sep 04 '14 at 12:21
  • sorry it was dynamic content, updated the url – Display name Sep 04 '14 at 12:27
  • Rendering it with the current version of Ghostscript looks fine to me. Of course I have no idea what the ImageMagick configuration means in terms of Ghostscript configuration. – KenS Sep 04 '14 at 15:47
  • Hi - sorry too busy to give real answers, but can you look at Ghostscript having a bug in text anti-aliasing http://stackoverflow.com/questions/23085550/php-imagick-pdf-conversion-text-aliasing/23144243#23144243 which may be easier to investigate by calling ghostscript directly: http://stackoverflow.com/questions/23676548/imagick-converting-pdf-to-jpg-throws-an-error/23679893#23679893 – Danack Sep 04 '14 at 20:06

1 Answers1

5

For me im using ghostscript to extract images in JPEG with high quality, this is my script:

gs -sDEVICE=jpeg -dAutoRotatePages=/None -o D:\temp\cover_thumb.jpg -dFirstPage=1 -dLastPage=1 -dNOPAUSE -dJPEGQ=100 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -r150 -dUseTrimBox D:\temp\pdfs\a.pdf -q

you can play with the quality using the parameter -r im my case its 150 but you can increase it for more better quality

mmoghrabi
  • 1,233
  • 1
  • 14
  • 23