Bug 689549 - Gradients from a PDF not rendering as expected
Summary: Gradients from a PDF not rendering as expected
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 8.60
Hardware: PC Windows 2000
: P4 normal
Assignee: Michael Vrhel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-04 13:44 UTC by spoon
Modified: 2016-10-13 18:47 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
Adobe Reader 7.0.7 rendering (19.51 KB, image/x-png)
2007-11-04 13:45 UTC, spoon
Details
PDF->png16m output (10.30 KB, image/x-png)
2007-11-04 13:46 UTC, spoon
Details
PDF->pngalpha output (9.25 KB, image/x-png)
2007-11-04 13:47 UTC, spoon
Details
PDF->PS->png16m with graphicalphabits=4 (17.33 KB, image/x-png)
2007-11-04 13:48 UTC, spoon
Details
PDF->PS->png16m with graphicalphabits=0 (6.66 KB, image/x-png)
2007-11-04 13:49 UTC, spoon
Details
channel_guide.pdf (1.12 MB, application/pdf)
2007-11-05 21:59 UTC, Marcos H. Woehrmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spoon 2007-11-04 13:44:53 UTC
I am seeing some rendering problems with gradients in a particular PDF file. 
These problems seem to be exaggerated after an intermediate step of converting 
to PS. These tests were done with GPLed 8.60, but I was also seeing the same 
problem with AFPLed 8.53.

The PDF in question (not attached) is:
http://www.xmradio.com/pdf/channel_guide.pdf

Pay close attention to gradients on the rendered output. I’ll be using 
the "Soul Street" logo for an example, but this affects many other parts of the 
PDF.

I've attached a screen scrape from Adobe Reader 7.0.7. This is how I would 
expect the rendered output to look. The outline of the logo is smooth on both 
the "interior" (the side touching the gradient) and "exterior" of the logo and 
the gradient is smooth.

Ghostscript rendering the PDF using png16m:
gswin32c.exe -dSAFER -dBATCH -dNOPAUSE –r1000 -dGraphicsAlphaBits=4 -
dTextAlphaBits=4 -sDEVICE=png16m -sOutputFile=C:\gs-test\pdf2png16m.png c:\gs-
test\channel_guide.pdf
The gradient is still smooth, but the interior of the outline is jaggy.

Now using pngalpha:
gswin32c.exe -dSAFER -dBATCH -dNOPAUSE -r1000 -dGraphicsAlphaBits=4 -
dTextAlphaBits=4 -sDEVICE=pngalpha -sOutputFile=C:\gs-test\pdf2pngA.png c:\gs-
test\channel_guide.pdf
The gradient now has visible banding.

Something that exaggerates the problem is to go PDF->PS->PNG:
gswin32c.exe -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pswrite -sOutputFile=C:\gs-
test\tmp.ps c:\gs-test\channel_guide.pdf
gswin32c.exe -dSAFER -dBATCH -dNOPAUSE -r1000 -dGraphicsAlphaBits=4 -
dTextAlphaBits=4 -sDEVICE=png16m -sOutputFile=C:\gs-test\3step16m-4.png c:\gs-
test\tmp.ps
The gradient here looks very bad. Interior of the outline is jaggy.

PDF->PS->PNG with no AlphaBits option causes the gradient to appear correct, 
but back come the jaggies.

So, there are several issues I'm seeing here:
1) The interior outline of this logo looks very jagged while the exterior 
outline looks smooth.
2) pngalpha produces banding while png16m doesn't. This doesn't make much sense 
to me as the RGB colorspace should be the same.
3) PDF->PS->PNG produces nasty artifacts with alphabits in these gradient 
regions. (why would this render different than just PDF->PNG?)
Comment 1 spoon 2007-11-04 13:45:57 UTC
Created attachment 3521 [details]
Adobe Reader 7.0.7 rendering
Comment 2 spoon 2007-11-04 13:46:45 UTC
Created attachment 3522 [details]
PDF->png16m output
Comment 3 spoon 2007-11-04 13:47:44 UTC
Created attachment 3523 [details]
PDF->pngalpha output
Comment 4 spoon 2007-11-04 13:48:39 UTC
Created attachment 3524 [details]
PDF->PS->png16m with graphicalphabits=4
Comment 5 spoon 2007-11-04 13:49:06 UTC
Created attachment 3525 [details]
PDF->PS->png16m with graphicalphabits=0
Comment 6 Marcos H. Woehrmann 2007-11-05 21:59:35 UTC
Created attachment 3529 [details]
channel_guide.pdf

Original file, attached for archival purposes.
Comment 7 Shailesh Mistry 2011-07-24 19:20:10 UTC
Bug still reproducible in Ghostscript 9.03