[
https://issues.apache.org/jira/browse/PDFBOX-6024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18113685#comment-18113685
]
Daniel Persson commented on PDFBOX-6024:
----------------------------------------
Hi again.
Seems the premise of the previous patch was incorrect, and now that Fable 5.1
has been released, I tried again, and it found a solution in 15 minutes. The
patch 0001-PDFBOX-6024-apply-transfer-function-to-soft-mask-val.patch seems
reasonable, and it works with my full test batch of 50k pages. As this is
AI-generated, you might not want to apply it directly, but I think the gist is
interesting. This is the report from the AI about our previous patch:
{code:java}
Root cause. It is not a size mismatch between mask and image. The red overlay
is a form that fills a rectangle larger than its soft mask's group bounding
box. That mask has a white backdrop color and an inverting transfer function,
which InDesign writes for inverted image masks. The spec says the mask value
outside the group's bounding box is the backdrop luminosity with the transfer
function applied, so here it should be zero and nothing outside the box should
show. PDFBox applied the transfer function only to pixels inside the mask image
and used the raw white backdrop everywhere else. The two strips where the red
rectangle extends past the mask box, above the photo and to its right, were
therefore painted fully red. That is exactly the L shape in your screenshot.
Spec reference: PDF Reference 1.7 section 7.5.4, page 552, or ISO 32000-1
section 11.6.5.2. {code}
Best regards
Daniel
> Incorrect rendering of complex masks
> ------------------------------------
>
> Key: PDFBOX-6024
> URL: https://issues.apache.org/jira/browse/PDFBOX-6024
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 3.0.5 PDFBox
> Reporter: Daniel Persson
> Priority: Major
> Attachments:
> 0001-PDFBOX-6024-apply-transfer-function-to-soft-mask-val.patch,
> DN-A4-20250604-A-06-Nyheter.pdf, adobe.png,
> gs-bugzilla689309-reduced-bc1_RGB.pdf,
> gs-bugzilla689931_reduced-Multiply.pdf, gs-bugzilla689931_reduced-Screen.pdf,
> p1_proportional_mapping.patch, pdfbox.jpg, poppler-1.png
>
>
> This PDF seems to render incorrectly. I can view it in Adobe and Chrome
> correctly but neither Poppler or PDFBox render it correctly.
> The masking of the left image is strange so it adds and extra orange border.
> I've looked into the PDF a bit and it seems to be multiple masks in ExtGState
> then rendered with an rect inside of a Form. So solving this is probably not
> easy.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]