You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2022/11/02 07:05:00 UTC

[jira] [Commented] (PDFBOX-5526) Apply subsampling and region to masks

    [ https://issues.apache.org/jira/browse/PDFBOX-5526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627492#comment-17627492 ] 

Tilman Hausherr commented on PDFBOX-5526:
-----------------------------------------

Do you have a file that shows the effect and can you share it? I likely have one, but I would have to write some code to find it.

> Apply subsampling and region to masks
> -------------------------------------
>
>                 Key: PDFBOX-5526
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5526
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 2.0.26
>            Reporter: Velislava Yanchina
>            Assignee: Andreas Lehmkühler
>            Priority: Trivial
>             Fix For: 2.0.28, 3.0.0 PDFBox
>
>
> When {{{}{}}}`PDImageXObject.{{{}getImage()`{}}} gets invoked with subsampling and region, internally it loads the entire mask into memory: [https://github.com/apache/pdfbox/blob/961c052d52dd9ab2dd3d7cd762a5046e5cc85a91/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java#L465]
> and applies the entire mask on the subsampled image.
> Which is extra work and can cause `OOM` exceptions. 
> The proposed optimisation is to pass `region` and `subsampling` params to `PDImageXObject.getOpaqueImage() `here - [https://github.com/apache/pdfbox/blob/961c052d52dd9ab2dd3d7cd762a5046e5cc85a91/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java#L548]
> such that masks are also subsampled before applying them...



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org