You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (Jira)" <ji...@apache.org> on 2022/10/17 06: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=17618666#comment-17618666 ] 

Andreas Lehmkühler commented on PDFBOX-5526:
--------------------------------------------

Any proposal is welcome especially if it reduces the consumption of resources and/or speeds up long running processes.

Please keep it simple and don't add any code which isn't related to the topic of your proposal and don't do any code formatting. See [coding conventions|https://pdfbox.apache.org/codingconventions.html] for further details 

> 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
>            Priority: Trivial
>             Fix For: 2.0.28
>
>
> 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