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
PNG -> PDF-Conversion results in corrupted image
-
- Posts: 2
- Joined: 2017-10-30T03:14:43-07:00
- Authentication code: 1151
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: PNG -> PDF-Conversion results in corrupted image
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...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.
Code: Select all
magick -density 300 GoldenGoose-30.png -strip test.pdf
-
- Posts: 2
- Joined: 2017-10-30T03:14:43-07:00
- Authentication code: 1151
Re: PNG -> PDF-Conversion results in corrupted image
Many thanks, that worked for me. Is this a problem related to Ghostscript or to ImageMagick?
How did you figure this out?
Michael
How did you figure this out?
Michael
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: PNG -> PDF-Conversion results in corrupted image
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...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?
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: PNG -> PDF-Conversion results in corrupted image
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.
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.
snibgo's IM pages: im.snibgo.com
Re: PNG -> PDF-Conversion results in corrupted image
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.