Bug 703184 - pngalpha device output white background for large image
Summary: pngalpha device output white background for large image
Status: RESOLVED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Transparency (show other bugs)
Version: 9.53.3
Hardware: PC Linux
: P4 normal
Assignee: Michael Vrhel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-26 03:34 UTC by Yichao Yu
Modified: 2021-11-10 00:26 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Example input PDF. (4.34 KB, application/pdf)
2020-11-26 03:34 UTC, Yichao Yu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yichao Yu 2020-11-26 03:34:25 UTC
Created attachment 20235 [details]
Example input PDF.

This seems to be a similar issue to https://bugs.ghostscript.com/show_bug.cgi?id=692224 but that one is marked as fixed.

The attached pdf shows a simple transparency gradient from left to right. This get converted correctly using `gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -sOutputFile=fade_img_left.png -r2000 fade_img_left.pdf` but becomes opaque white with `gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -sOutputFile=fade_img_left.png -r5000 fade_img_left.pdf`. This limit seems to be related to the total size since reducing the vertical size changes the threshold. For a PDF with more complex shape, the transparency appears to be broken for patches of the picture that contain non-zero values so it seems that there are multiple code paths that handles the conversion and not all of them handles transparency correctly.....
Comment 1 Peter Cherepanov 2020-12-25 01:39:13 UTC
The bug is reproduced in the current master branch on GNU/Linux and
Android platforms.
Comment 2 Girts 2021-09-28 11:19:48 UTC
Hi,

We also encountered this issue.
Some things we noticed:

1) The issue starts when the output image area exceeds about 20.8Mpix (tested with different files increasing output resolution step by step, and it looks that it always starts at exactly the same point)
2) Everything is fine in 9.52, the problem started in later versions (9.53.x, 9.54, 9.55 all seem to have it)
Comment 3 Michael Vrhel 2021-11-10 00:01:32 UTC
I tested with head (as of https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=0f03d72f51f09eae5f3a5cfc452d58c19db2756c) and it seems to render fine.
Comment 4 Yichao Yu 2021-11-10 00:26:18 UTC
I just compiled the latest master and it does appear to be fixed, even for 10x higher resolution.
Is there a test for this to make sure it doesn't regress again?