Page 1 of 1
PNG -> PDF-Conversion results in corrupted image
Posted: 2017-10-30T06:22:27-07:00
by michael_kaeppler
Hi all,
I'm trying to convert a PNG-File to PDF. The resulting PDF has red artefacts and a completely scrambled page layout.
Input and Output files are here:
https://www.dropbox.com/sh/u0k5s8re787o ... nzXca?dl=0
My command:
magick -density 300 GoldenGoose-30.png test.pdf
My OS:
Windows 10 Pro Version 10.0.15063 Build 15063
Ghostscript:
GPL Ghostscript 9.22 (2017-10-04) 32bit
ImageMagick:
Version: ImageMagick 7.0.7-8 Q16 x64 2017-10-14
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License:
http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps raw rsvg tiff webp xml zlib
Any help appreciated. This also occurs with the last 6.x build and also with older ghostscript versions...
Thanks
Michael
Re: PNG -> PDF-Conversion results in corrupted image
Posted: 2017-10-30T10:06:06-07:00
by GeeMack
michael_kaeppler wrote: ↑2017-10-30T06:22:27-07:00
Hi all,
I'm trying to convert a PNG-File to PDF. The resulting PDF has red artefacts and a completely scrambled page layout.
The conversion seems to have a problem with the color profile in the original image. I got it to produce what appears to be a correct result by removing the color profile with "-strip". You might try something like this. It worked for me with IM 7.0.7-8 and GS 9.21 on Windows 10 Pro...
Code: Select all
magick -density 300 GoldenGoose-30.png -strip test.pdf
Re: PNG -> PDF-Conversion results in corrupted image
Posted: 2017-10-31T04:17:47-07:00
by michael_kaeppler
Many thanks, that worked for me. Is this a problem related to Ghostscript or to ImageMagick?
How did you figure this out?
Michael
Re: PNG -> PDF-Conversion results in corrupted image
Posted: 2017-10-31T07:23:09-07:00
by GeeMack
michael_kaeppler wrote: ↑2017-10-31T04:17:47-07:00Many thanks, that worked for me. Is this a problem related to Ghostscript or to ImageMagick?
How did you figure this out?
I tried converting your original PNG to a PDF and had the same problem you had. It also created the same issue when I tried converting it to a TIFF. So I tried just converting it to another PNG and got a warning about the color profile...
Code: Select all
D:\IM\Test006>magick GoldenGoose-30.png test.png
magick: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG `test.png' @ warning/png.c/MagickPNGWarningHandler/1744.
Then I tested it by stripping the profile, and that eliminated the warning and produced what appears to be a proper output. I don't know if the software that created the original PNG included a non-compliant profile, or if maybe ImageMagick is handling the profile incorrectly. Someone who knows more about the internals of IM would have to weigh in on that.
Re: PNG -> PDF-Conversion results in corrupted image
Posted: 2017-10-31T07:37:47-07:00
by snibgo
In versions 6.9.5-3 and 7.0.3-5, converting to PDF works fine, and the result viewed with Adobe Reader looks good. IM doesn't use Ghostscript to write PDF.
When either version converts to PNG, I get that warning. I think it's simply a warning, that someone (GlennRP?) thinks grayscale PNG files shouldn't have colour profiles. But it does put the profile in the file. (Glenn knows far more about PNG than I do.)
I don't know what the PDF problem is, but I suspect an IM bug introduced after my versions.
Re: PNG -> PDF-Conversion results in corrupted image
Posted: 2017-10-31T12:57:08-07:00
by glennrp
snibgo wrote: ↑2017-10-31T07:37:47-07:00
I
When either version converts to PNG, I get that warning. I think it's simply a warning, that someone (GlennRP?) thinks grayscale PNG files shouldn't have colour profiles. But it does put the profile in the file. (Glenn knows far more about PNG than I do.)
The PNG speciification for the iCCP chunk declares that a grayscale color profile is invalid in an RGB image. I happen to think that that requirement is a little overreaching, but there you have it.