You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2015/04/08 22:28:13 UTC
[jira] [Comment Edited] (PDFBOX-2750) Rendering in poor quality in
2.0 but not in 1.8.*
[ https://issues.apache.org/jira/browse/PDFBOX-2750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14485937#comment-14485937 ]
John Hewson edited comment on PDFBOX-2750 at 4/8/15 8:28 PM:
-------------------------------------------------------------
Setting rendering hints in PDImageXObject.applyMask also 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}
was (Author: jahewson):
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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org