Bug 689974 - The conversion PDF to PNG produces a picture with the white line
Summary: The conversion PDF to PNG produces a picture with the white line
Status: CONFIRMED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 8.62
Hardware: PC Windows XP
: P4 normal
Assignee: Robin Watts
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-17 03:50 UTC by Oleg Schiedamnn
Modified: 2021-01-03 17:21 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments
6jahre_2sp_4c.pdf (49.38 KB, application/pdf)
2008-07-17 03:52 UTC, Oleg Schiedamnn
Details
6jahre_2sp_4c_r111x111_p1.png (9.00 KB, image/png)
2008-07-17 03:53 UTC, Oleg Schiedamnn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Schiedamnn 2008-07-17 03:50:17 UTC
I convert a PDF file to a PNG file. The PNG file has a white line in the 
middle.

Command line under WindowsXP:
...\gs8.62\bin\gswin32c.exe -dQUIET -dNOPAUSE  -dBATCH -sstdout=%stderr -
dFirstPage=1 -dLastPage=1 -sDEVICE=pngalpha -dTextAlphaBits=4 -
dGraphicsAlphaBits=4 -dDOINTERPOLATE -r111x111 -
sOutputFile=6jahre_2sp_4c_r111x111_p1.png 6jahre_2sp_4c.pdf

The effect is dependent on the resolution. But the version 8.61 converts the 
image properly.
The same effect under Linux.
Comment 1 Oleg Schiedamnn 2008-07-17 03:52:14 UTC
Created attachment 4226 [details]
6jahre_2sp_4c.pdf

Source File
Comment 2 Oleg Schiedamnn 2008-07-17 03:53:55 UTC
Created attachment 4227 [details]
6jahre_2sp_4c_r111x111_p1.png

My example PNG
Comment 3 Ken Sharp 2008-07-17 04:09:02 UTC
I'll leave it to Alex to decide for sure, but this looks like its caused by
multiple images abutted.

There are actually 6 images in the file (all 139 by 121), which are butted
together top, bottom, left and/or right. All the images are anamorphically
scaled (by the same amount):

33.361 0 0 28.812 

And they are placed at non-integer locations.

When the location, scaling, resolution and rounding errors happen to hit certain
values the images don't quite butt up together leaving a small gap, probably the
scaled height of the image does not quite match the scaled location of the next
image. The 'white line' is a pretty good match by eye for the end of the upper
images.

I'm pretty sure I've seen this reported elsewhere. Experimentation with zoom
values in Acrobat can often reproduce this, though you have to turn off 'smooth
images' first.

Comment 4 Oleg Schiedamnn 2008-07-17 04:29:16 UTC
I have seen that in the PDF 6 images are positioned side by side. And I 
suspect that the error comes through. 
Unfortunately, I get PDF files from an advertising agency and can not affect 
its production. The PNG resolution depends on the size of the target document 
and is dynamic.
Comment 5 Alex Cherepanov 2008-07-17 07:47:58 UTC
Important parameters are -dDOINTERPOLATE and -r . Other parameters can
be omitted or changed.

Interpolated picture has the stripe at 73, 91, 96, 101, 111, 196 dpi, but
has no stripe at any other integer resolution below 500 dpi.

Non-interpolated picture has no stripe at any integer resolution below 500 dpi.

Fixing this bug should be relatively easy by comparing image positions
and sizes in the interpolated and non-interpolated cases.
Comment 6 Ken Sharp 2013-06-12 09:07:07 UTC
Its still my personal opinion that this is an expected problem with files constructed in this way, but given that it only (allegedly) is a problem with interpolation I'm going to pass it to Robin to take a look.

IMO we should use the tiffscaled approach for any anti-aliased output and deprecate TextAlphaBits and GraphicsAlphaBits.
Comment 7 Robin Watts 2019-09-03 13:21:52 UTC
The problem still occurs with the 9.27 release candidate.

The simplest command line that gives the problem is:

 gs -sDEVICE=ppmraw -o test.ppm -r111 -dDOINTERPOLATE 6jahre_2sp_4c.pdf
Comment 8 Peter Cherepanov 2021-01-03 17:21:10 UTC
The problem is reproduced in the current master branch.