In order to convert a PDF with 100 pages to single PNG files, I've been using the following command:

C:\Program files\ImageMagick\convert -density 150 -alpha Opaque file.pdf file.png

But that resulted in PNGs that were over-saturated. This is why I modified the command to the following one, adding the colorspace parameter:

C:\Program files\ImageMagick\convert -colorspace sRGB -density 150 -alpha Opaque file.pdf file.png

The colors look good now. However, only the first page of the PDF is converted now, all others are just dropped. Why? Is the order of the arguments wrong? I've tested different orders but none with success.

However, accessing the subsequent pages directly (via file.pdf[1] etc.) works. But why doesn't it convert the full document in batch anymore?

ImageMagick version info:

Version: ImageMagick 6.8.1-9 2013-01-04 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: OpenMP
Delegates: bzlib freetype jp2 jpeg lcms lzma ps tiff x xml zlib

I used the following little workaround to solve the problem, but I don't like it, obviously:

for /L %%p in (1,1,100) do C:\ImageMagick\convert -colorspace sRGB -density 150 -alpha Opaque file.pdf[%%p] file-%%p.png

Edit: There's a better solution as well:

  1. In ImageMagick's delegates.xml, in section <delegate decode="ps:alpha" replace sDEVICE=pngalpha by sDEVICE=pnmraw
  2. Use C:\ImageMagick\convert -colorspace sRGB -density 150 -alpha off file.pdf file.png
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.