[
https://issues.apache.org/jira/browse/PDFBOX-2750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14485937#comment-14485937
]
John Hewson commented on PDFBOX-2750:
-------------------------------------
Setting rendering hints in PDImageXObject.applyMask gives some improvement by
using high-quality interpolation for the image scaling:
{code}
// scale mask to fit image
if (mask.getWidth() != width || mask.getHeight() != height)
{
BufferedImage mask2 = new BufferedImage(width, height, mask.getType());
Graphics2D g = mask2.createGraphics();
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g.drawImage(mask, 0, 0, width, height, 0, 0, mask.getWidth(),
mask.getHeight(), null);
g.dispose();
mask = mask2;
}
{code}
However the issue that the mask is scaled-down to the image size (rather than
the other way around) remains.
> Rendering in poor quality in 2.0 but not in 1.8.*
> -------------------------------------------------
>
> Key: PDFBOX-2750
> URL: https://issues.apache.org/jira/browse/PDFBOX-2750
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Assignee: John Hewson
> Attachments: PDFBOX-2750-1.8.jpg, PDFBOX-2750-2.0.jpg, PDFBOX-2750.pdf
>
>
> The attached PDF is rendered in poor quality in 2.0, but not in 1.8.*
> (submitted by Vanja K. on the user mailing list).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]