You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by GitBox <gi...@apache.org> on 2021/03/26 21:27:06 UTC

[GitHub] [pdfbox] Schmidor opened a new pull request #111: Faster PDImageXObject.applyMask

Schmidor opened a new pull request #111:
URL: https://github.com/apache/pdfbox/pull/111


   Less data copy operations over all. Linewise bulk copy instead of per
   pixel.
   
   The softMask / matte calculation might need to be checked. I have only found one PDF in https://issues.apache.org/jira/browse/PDFBOX-4267


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-810391439


   Yeah I think this goes in the same direction as something I suspected this morning, but didn't have the time to test, that the code didn't multiply the matte values (which are 0..1). It works fine now! I'm gonna commit soon.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-808639400


   Thanks, this looks promising. However the rendering of this file is different
   [PDFBOX-2060.pdf](https://github.com/apache/pdfbox/files/6215064/PDFBOX-2060.pdf)
   
   old rendering:
   ![PDFBOX-2060 pdf-1](https://user-images.githubusercontent.com/6665575/112708948-a7c71900-8eb5-11eb-886c-ddec40931625.png)
   
   new rendering:
   ![PDFBOX-2060 pdf-1](https://user-images.githubusercontent.com/6665575/112708931-882ff080-8eb5-11eb-9065-931a0cedd27b.png)
   
   difference:
   ![PDFBOX-2060 pdf-1 png-diff](https://user-images.githubusercontent.com/6665575/112708932-8bc37780-8eb5-11eb-91cb-44c9e31b2a87.png)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809889429


   I ran ExtractImages and displayed with IrfanView; on the left, the "old" image, on the right, the "new" image.
   ![grafik](https://user-images.githubusercontent.com/6665575/112931884-3db0ad00-911d-11eb-8f86-49c6156b5809.png)
   
   This rules out that "something" is triggered that happens at a later time.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-808905144


   Thanks; there one difference in rendering here (page 14):
   [PDFBOX-1359.pdf](https://github.com/apache/pdfbox/files/6217477/PDFBOX-1359.pdf)
   
   Original:
   ![PDFBOX-1359 pdf-14](https://user-images.githubusercontent.com/6665575/112755799-992a5000-8fe2-11eb-97cb-16fcafc6f64c.png)
   
   New:
   ![PDFBOX-1359 pdf-14](https://user-images.githubusercontent.com/6665575/112755927-279ed180-8fe3-11eb-976d-dc1d3b9585c3.png)
   
   Difference:
   ![PDFBOX-1359 pdf-14 png-diff](https://user-images.githubusercontent.com/6665575/112755931-2d94b280-8fe3-11eb-8c11-d04878f8866f.png)
   
   
   The difference can't been seen with a human eye so they're minor and I often have such differences myself when making changes. However here I don't understand what happened, there should only be a difference of 1 due to rounding. The differences algorithm (TestPDFToImages.diffImages()) only complains when there is a difference of 3.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] Schmidor edited a comment on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
Schmidor edited a comment on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-810126225


   Yeah, something when combining image and mask with the formula from PDF.js.
   ![result](https://user-images.githubusercontent.com/10960818/112976814-9b60eb80-9155-11eb-8502-315e6e366e05.png)
   
   I still don't know what I did wrong when changing the old formula from per pixel to per row, but it didn't work and made me look into PDF.js. Seems to be good now.
   ![result](https://user-images.githubusercontent.com/10960818/112980865-b97d1a80-915a-11eb-9c62-fb54bf2674f0.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] Schmidor closed pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
Schmidor closed pull request #111:
URL: https://github.com/apache/pdfbox/pull/111


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr edited a comment on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr edited a comment on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809889429


   I ran ExtractImages and displayed with IrfanView; on the left, the "old" image, on the right, the "new" image. The green color is the transparent background.
   ![grafik](https://user-images.githubusercontent.com/6665575/112931884-3db0ad00-911d-11eb-8f86-49c6156b5809.png)
   
   This rules out that "something" is triggered that happens at a later time.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] Schmidor commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
Schmidor commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-808810215


   I missed that not in every case the input is transformed to ARGB, fixed that.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] Schmidor commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
Schmidor commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-810126225


   Yeah, something when combining both with the formula from PDF.js.
   ![result](https://user-images.githubusercontent.com/10960818/112976814-9b60eb80-9155-11eb-8502-315e6e366e05.png)
   
   I still don't know what I did wrong when changing the old formula from per pixel to per row, but it didn't work and made me look into PDF.js. Seems to be good now.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] Schmidor commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
Schmidor commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809537218


   Yes, I compared my renderings to your PNG files. Didn't know that :) 
   The lines are definately a bit moved between before and after, but I don't see why.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809655521


   No further ideas from me today; the effect can be seen in PDFDebugger at 1000%, or in the image ( `Root/Pages/Kids/[0]/Resources/XObject/Im1/Resources/XObject/Im0` ) at 100%. I tried to change scaleImage that it copies the pixels directly with getRGB / setRGB and still got the effect.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809513863


   If you compared the pre-commits difference against my PNG file then the diff result doesn't mean much, because different jdks  / OS produce different renderings.
   
   I'll try to find out more about the details on the difference, to be sure that there isn't a bug in the diff code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] Schmidor edited a comment on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
Schmidor edited a comment on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-810126225


   Yeah, something when combining image and mask with the formula from PDF.js.
   ![result](https://user-images.githubusercontent.com/10960818/112976814-9b60eb80-9155-11eb-8502-315e6e366e05.png)
   
   I still don't know what I did wrong when changing the old formula from per pixel to per row, but it didn't work and made me look into PDF.js. Seems to be good now.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr edited a comment on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr edited a comment on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-810391439


   Yeah I think this goes in the same direction as something I suspected this morning, but didn't have the time to test, that the code didn't multiply the matte values (which are 0..1). It works fine now! I'm gonna commit soon.
   
   And it also shows the visual benefit of this "matte" thing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809590313


   OK I rendered two files at 1500 dpi and yes, there's a difference, so the diff code isn't the cause. The lines in the old codes are smoother. I'll test a few more things, maybe it's related to scaleImage() about interpolation being done or not (despite that the dimensions are identical).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] THausherr commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
THausherr commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809866198


   I tried to copy "image" into an ARGB image with the *old* code and this did not produce the effect, so this would mean scaleImage isn't to blame.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [pdfbox] Schmidor commented on pull request #111: Faster PDImageXObject.applyMask

Posted by GitBox <gi...@apache.org>.
Schmidor commented on pull request #111:
URL: https://github.com/apache/pdfbox/pull/111#issuecomment-809369236


   I have added this PDF and page 14 to the TestRendering.renderAndCompare(String fileName).
   But that is showing always a difference for me, with both versions from you and also if I switch to a commit before my changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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