[
https://issues.apache.org/jira/browse/PDFBOX-6232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18103303#comment-18103303
]
Tilman Hausherr commented on PDFBOX-6232:
-----------------------------------------
I worked on this on the weekend but ended nowhere. I made a reduced file and
with the old behavior, the mask would be on an outside position thus have no
effect. This isn't enough to be sure that this is correct.
My notes, for the next time I'll put some time into this:
PDFBOX-6232: better by applying the flip in getBounds()
{code}Root/Pages/Kids/[0]/Resources/XObject/X33/Resources/Pattern/P11/Resources/ExtGState/G10/SMask/G/Resources/Pattern/P8/Shading{code}
flipTG is false in first (outer) TransparencyGroup.<init>
debug images in applySoftMaskToPaint() have black axial shading regardless of
how logic is used (not surprising, that happens before
transparencyGroup.getBounds())
PDFBOX-5966: better by not applying the flip in getBounds()
{code}Root/Pages/Kids/[0]/Resources/Pattern/P995/Resources/ExtGState/G994/SMask/G/Resources/Pattern/P992/Shading{code}
flipTG is true in TransparencyGroup.<init>
Both files have a softmask, the difference is at what position to apply it
(tpgBounds, of which only origin (x,y) is used, see TODO).
Only one file (PDFBOX-6232) has isolated transparency groups. I suspect we're
not really handling this properly, but this is very advanced. Removing all the
/I entries changes nothing in the regression shown.
> PDF to Image conversion mis-rendered (transparency/soft-mask) due to PDFBox
> 3.0.6 regression
> --------------------------------------------------------------------------------------------
>
> Key: PDFBOX-6232
> URL: https://issues.apache.org/jira/browse/PDFBOX-6232
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.37, 3.0.5 PDFBox, 3.0.6 PDFBox, 3.0.7 PDFBox, 3.0.8
> PDFBox, 4.0.0
> Reporter: Kabir Soneja
> Priority: Major
> Labels: regression
> Attachments: pdfbox_softmask_regression_ipfree.pdf
>
>
> _Regression in PDFBox 3.0.5+ — rendering a page that composites a luminosity
> soft-mask (whose mask group is a shading-pattern gradient) through a tiling
> pattern inside an isolated transparency group causes the group backdrop to
> bleed through as hard-seamed horizontal bands. A region that should be a
> smooth gradient instead collapses toward the backdrop color_
> _Environment:_ PDFBox tools {{render}} (PDFRenderer / ImageIO), Java 17+,
> DeviceRGB, any DPI (observed at 165 DPI).
> _Steps to reproduce:_
> # Take the attached PDF (single page; no fonts, no text, no metadata;
> content is a synthetic blue→green gradient over a dark-red backdrop).
> # Render page 1 to an image with 3.0.4 and again with 3.0.6/3.0.7/3.0.8,
> e.g.:
> {{java -jar pdfbox-app-<ver>.jar render -i reproducer.pdf -dpi 165 -format
> png}}
> _Expected (3.0.4):_ the masked region shows a smooth, continuous gradient;
> the backdrop is fully covered where the soft-mask luminosity is high.
> Sampling a fixed band in the upper third yields a bright, saturated color
> (blue channel ~220).
> _Actual (3.0.5+):_ the same band is broken into hard-edged horizontal seams
> with the dark backdrop bleeding through; the sampled band collapses toward
> the backdrop (blue channel ~80).
> _Structure that triggers it (PDF operators):_
> * Page paints an _isolated transparency group_ ({{{}/Group << /S
> /Transparency /I true /CS /DeviceRGB >>{}}}).
> * Inside the group: a dark backdrop fill, then a fill painted via a _Type-1
> tiling pattern_ ({{{}/Pattern cs /P scn{}}}).
> * The tiling pattern's content stream sets an ExtGState carrying a
> _luminosity soft mask_ ({{{}/SMask << /S /Luminosity /G <group> >>{}}}), then
> fills using a _Type-2 shading pattern_ (axial gradient) as the visible color.
> * The soft-mask group itself fills via _another Type-2 shading pattern_ (an
> axial gradient), giving the mask partial/variable luminosity.
> The interaction of (isolated group) × (luminosity soft mask driven by a
> shading-pattern gradient) × (tiling pattern) is what regressed — removing any
> one of those three elements makes the defect disappear. Solid-color
> masks/fills do not trigger it; the shading-pattern (gradient) mask is
> required.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]