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

Christian Appl commented on PDFBOX-4928:
----------------------------------------

Sorry, I will try to explain clearer what I meant. Maybe the following code 
example will help?
{code:java}
File heicPDF = new File("D:\\experiments", "test.pdf");
PDDocument document = PDDocument.load(heicPDF);
try {
   Map<RenderingHints.Key, Object> renderOptions = new 
HashMap<RenderingHints.Key, Object>();
   renderOptions.put(RenderingHints.KEY_RENDERING, 
RenderingHints.VALUE_RENDER_QUALITY);
   renderOptions.put(RenderingHints.KEY_INTERPOLATION, 
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
   renderOptions.put(RenderingHints.KEY_QUALITY_RENDERING_METHOD, 
RenderingHints.VALUE_PRESCALE_RENDERING_METHOD);

   PDFRenderer pdfRenderer = new PDFRenderer(document);
   RenderingHints renderingHints = new RenderingHints(renderOptions);
   pdfRenderer.setRenderingHints(renderingHints);

   BufferedImage image = pdfRenderer.renderImageWithDPI(1, 500, ImageType.RGB);
   ImageIO.write(image, "PNG", new File("D:\\experiments", 
"out_disabled_500.png"));
} finally {
   document.close();
}
{code}
My suggestion is the introduction of an additional rendering parameter for the 
quality rendering (KEY_QUALITY_RENDERING_METHOD in this example). Instead of 
(scaleX < 0.5 || {color:#000000}scaleY {color}< 0.5) you could check for: 
{color:#000000}RenderingHints{color}.{color:#871094}VALUE_PRESCALE_RENDERING_METHOD{color}.equals({color:#871094}graphics{color}.getRenderingHint({color:#000000}RenderingHints{color}.{color:#871094}KEY_QUALITY_RENDERING_METHOD{color})

This would enable the user to directly select whether graphics.drawImage() 
shall apply the transformation matrix, or the introduced prescaling shall be 
applied. (to intentionally enable or disable the prescaling.)

> Could the new rendering method of PageDrawer be optional?
> ---------------------------------------------------------
>
>                 Key: PDFBOX-4928
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4928
>             Project: PDFBox
>          Issue Type: Wish
>          Components: Rendering
>    Affects Versions: 2.0.20
>            Reporter: Christian Appl
>            Priority: Major
>
> This relates to {color:#008dde}PDFBOX-4516, PDFBOX-4527, PDFBOX-4815, 
> PDFBOX-4886, PDFBOX-4863{color}{color:#008dde}
>  I have tested the new prescaled rendering method for the 
> {color}org.apache.pdfbox.rendering.{color:#008dde}PageDrawer 
> {color:#172b4d}with PDFBox:2.0.21-SNAPSHOT{color}{color} for different 
> images, with different resolutions, target image sizes etc. and compared the 
> results to our old expectations (pre 2.0.20). And I really like it!
>  
>  However it seems to depend on the person's subjective perception (atleast 
> for my tested images), whether I like the old or the new results better. When 
> asking my colleagues, I heard arguments for both sides.
>  
>  Therefore my question is: Could a RenderingHint be introduced to 
> disable/enable this separately and more intentionally, instead of assuming, 
> that the scaling method must always be applied for specific scaling factors?
>  This would allow users to select the scaling method according to their own 
> liking and needs.
>  
>  I can not really find a crystal clear, objective answer, whether the one or 
> the other is "better", therefore I would prefer being able to de/activate it 
> according to my own judgement.
>  As far as I understand, the criterion (scaleX < {color:#1750eb}0.5 {color}|| 
> {color:#000000}scaleY {color}< {color:#1750eb}0.5{color}) has been selected 
> rather arbitrarily.( ? )
>  But what if I want to apply it even to images above those scaling factors?
>  What if I want to not apply it to images bellow those scaling factors?
>  What if I want to apply it to Image A, but not to Image C, for some unknown 
> reason?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to