Page 1 of 1

Converting PDF to PNG Issue

Posted: 2018-08-23T18:18:07-07:00
by sgreene
Hi Everyone,

I am having an issue while converting a PDF to a thumbnail PNG image, either the text doesn't display or is garbled up... Hope someone can help I can't determine any other possible ways to fix the issue.

Here is what the PDF looks like:
Image

This is the result of the conversion:
Image

Command I am using is:
convert -colorspace RGB Abcs.pdf[0] -colorspace sRGB -resize '25%' -quality 100 test.png

Software Versions I am using
ImageMagick 6.9.7-4 Q16 x86_64 20170114
GPL Ghostscript 9.22 (2017-10-04)
Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-32-generic x86_64)

Re: Converting PDF to PNG Issue

Posted: 2018-08-23T18:37:32-07:00
by fmw42
Please post the actual pdf to some free hosting service that won't change it or zip it first before posting. Then put the URL to the PDF or zip file here.

You seem to convert to linear RGB when reading the PDF rather than nonlinear sRGB. Then you change it to non-linear. That could be an issue.

Try just reading it in as sRGB.

Code: Select all

convert -colorspace sRGB Abcs.pdf[0] -resize '25%' -quality 100 test.png

Re: Converting PDF to PNG Issue

Posted: 2018-08-23T18:59:00-07:00
by sgreene
fmw42 wrote: 2018-08-23T18:37:32-07:00 Please post the actual pdf to some free hosting service that won't change it or zip it first before posting. Then put the URL to the PDF or zip file here.

You seem to convert to linear RGB when reading the PDF rather than nonlinear sRGB. Then you change it to non-linear. That could be an issue.

Try just reading it in as sRGB.

Code: Select all

convert -colorspace sRGB Abcs.pdf[0] -resize '25%' -quality 100 test.png
thanks for the quick response i did try your suggested command but got the same results. here is the full pdf file.

Re: Converting PDF to PNG Issue

Posted: 2018-08-24T00:11:00-07:00
by ifkey
up)

Re: Converting PDF to PNG Issue

Posted: 2018-08-24T09:12:12-07:00
by fmw42
This works fine for me using ImageMagick 6.9.10.10 Q16 Mac OSX with ghostscript 9.21 and libpng 1.6.34

Code: Select all

convert -colorspace sRGB -density 288 abcsousr.pdf[0] -resize 25% result.png
If this does not work, then upgrade ghostscript (as I have heard there were issues with 9.22) and also upgrade libpng, if needed.

Re: Converting PDF to PNG Issue

Posted: 2018-08-24T12:47:11-07:00
by snibgo
It also works fine for me, IM 7.0.7-28 and Ghostscript v9.19.

Re: Converting PDF to PNG Issue

Posted: 2018-08-26T06:30:44-07:00
by sgreene
Thank you everyone, I have manually upgraded to 9.23 (what a pain) and it's working great now. I was using apt-get to install and it only has 9.22 as latest version.