PDF > PNG Conversion Issues

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
landstrykere
Posts: 5
Joined: 2017-11-16T09:01:34-07:00
Authentication code: 1152

PDF > PNG Conversion Issues

Post by landstrykere »

I'm attempting to convert multi-page PDFs to PNGs (any individual image types will work), but am consistently getting horizontal white lines after the conversion:

Image

These are reminiscent of display issues on Adobe InDesign PDFs (where PDFs for this use case will be created), though I've never had seen them once a document is printed, etc.

Version:

Code: Select all

Version: ImageMagick 7.0.7-11 Q16 x86_64 2017-11-12 http://www.imagemagick.org
Command:

Code: Select all

convert SourcePDF -colorspace sRGB -background white -alpha remove -quality 90 OutputPNG
The issue seems to persist independent of reordering, including/excluding colorspace, density, quality. Relatively new to IM, so it's very likely that I'm missing something obvious. Thanks in advance!

Folder with input/output files
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF > PNG Conversion Issues

Post by fmw42 »

This command works fine for me on IM 7.0.7.11 Q16 Mac OSX

Code: Select all

magick -colorspace sRGB test_export.pdf -background white -alpha remove out.png
Note that you should put -colorspace sRGB before the (vector) PDF input. Or use profiles after reading the PDF.

Also note that -quality is different form png than for jpg. So your value may or may not be good. See http://www.imagemagick.org/script/comma ... hp#quality

Furthermore, in IM 7, magick replaces convert, otherwise, you get the IM 6 convert

You might check your version of Ghostscript and libpng to be sure you are using a current version. My GS is 9.21. My libpng is 1.6.30
landstrykere
Posts: 5
Joined: 2017-11-16T09:01:34-07:00
Authentication code: 1152

Re: PDF > PNG Conversion Issues

Post by landstrykere »

You're not seeing any white hairlines on your export? Weird..

I tried your command as is (thanks for the note on convert > magick) and am still getting the same result. Ghostscript and libpng look like they're both current (9.22 and 1.6.34).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF > PNG Conversion Issues

Post by fmw42 »

I ran my command 20 times and none of them had striping like on yours. Did you try my command without the -quality?
landstrykere
Posts: 5
Joined: 2017-11-16T09:01:34-07:00
Authentication code: 1152

Re: PDF > PNG Conversion Issues

Post by landstrykere »

Copied and pasted your exact command and left out the -quality and it's still there. Out of curiosity, I installed everything fresh on a separate machine and got the same result.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF > PNG Conversion Issues

Post by fmw42 »

I am at a loss unless there is a bug in our newer Ghostscript or PNG version?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF > PNG Conversion Issues

Post by fmw42 »

What is your platform and what tool are you using to view it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF > PNG Conversion Issues

Post by fmw42 »

Here is my result:

Code: Select all

magick -colorspace sRGB test_export.pdf -background white -alpha remove test_export.png
Image

When you view it in your same tool that you view your own result, does it show any stripes?
landstrykere
Posts: 5
Joined: 2017-11-16T09:01:34-07:00
Authentication code: 1152

Re: PDF > PNG Conversion Issues

Post by landstrykere »

I'm on Mac OS X, too. The viewing tool doesn't seem to have any effect (tried Preview, Photoshop) and your result appears without the lines in both viewers.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF > PNG Conversion Issues

Post by fmw42 »

What version of Mac OSX. I am on Sierra.

How did you install IM and the needed delegates? From ImageMagick, Homebrew, MacPorts?
landstrykere
Posts: 5
Joined: 2017-11-16T09:01:34-07:00
Authentication code: 1152

Re: PDF > PNG Conversion Issues

Post by landstrykere »

Still on El Capitan.

I installed both IM and Ghostscript through Homebrew.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF > PNG Conversion Issues

Post by fmw42 »

I do not know what more to suggest other than trying to back down your Ghostscript and PNG to the same versions I have. Or try installing IM 6 in place of IM 7.

By the way, I install all my delegates from MacPorts and then install IM from source. See viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202. This is of course much more complicated than just using Homebrew.
Post Reply