Page 1 of 1

Converting PDF to JPG: problem w/images inside the PDF

Posted: 2012-10-25T02:02:03-07:00
by paol0
Hello,

I'm converting PDFs to sequences of JPGs.

Images inside the PDF are not rendered well. I think there is some problem in scaling, and artifacts appears.

Below is an explaining image with two portiong of a JPG obtained from PDF.

On the left side the result is from Photoshop. On the right from ImageMagick (look at diagonal lines)

Image

The issued command that generated the PDF with ImageMagick was

convert -colorspace sRGB -quality 92 -density 75 -strip /Users/paolo/Desktop/test/test.pdf /Users/paolo/Desktop/test/test.jpg

(In case it may be usefull to know: the image inside the PDF, is CMYK, 90 dpi, with Jpeg compression, so ImageMagick is actually performing a downsample).

Kind regards,
Paolo.

Re: Converting PDF to JPG: problem w/images inside the PDF

Posted: 2012-10-25T09:10:49-07:00
by fmw42
try increasing the density

Re: Converting PDF to JPG: problem w/images inside the PDF

Posted: 2012-10-26T04:11:55-07:00
by magick
To increase the quality of the PDF rendering, supersample:
  • convert -colorspace sRGB -quality 92 -density 300 -strip /Users/paolo/Desktop/test/test.pdf -resize 25% /Users/paolo/Desktop/test/test.jpg

Re: Converting PDF to JPG: problem w/images inside the PDF

Posted: 2014-07-25T02:47:04-07:00
by rubenvb
I have the same issue converting a pdf file to a png file with the command:

Code: Select all

convert -density=1800 testgradient.pdf testgradient.png
The resulting PNG has some mis-coloured pixels, which are unwanted, and the PDF only contains vector graphics.
The DF file is available here:
https://dl.dropboxusercontent.com/u/587 ... adient.pdf

and was generated from following LaTeX/TikZ code with pdflatex:

Code: Select all

\documentclass{standalone}
\pagestyle{empty}
 
\usepackage{tikz}
\usetikzlibrary{shadings}

\begin{document}
\begin{tikzpicture}
\coordinate (center) at (0,0);

\shade[shading=color wheel] (center) circle (1);
\end{tikzpicture}
\end{document}
using an even higher depth and scaling that back gets rid of the artifacts though that shouldn't be necessary, also, it uses a lot more memory and results in a relatively much larger file:

Code: Select all

convert -density 7200 -resize 25% testgradient.pdf testgradient.png

Re: Converting PDF to JPG: problem w/images inside the PDF

Posted: 2014-07-25T03:32:20-07:00
by magick
We get expected results. We're using ImageMagick 6.8.9-5, the current release, and Ghostscript 9.14.

Re: Converting PDF to JPG: problem w/images inside the PDF

Posted: 2014-07-31T00:56:36-07:00
by rubenvb
You are right, I can't reproduce this anymore. Sorry for the noise.