You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2017/05/22 08:34:24 UTC

[Bug 61112] New: Ppt background is black when using Apache POI to convert slide to image

https://bz.apache.org/bugzilla/show_bug.cgi?id=61112

            Bug ID: 61112
           Summary: Ppt background is black when using Apache POI to
                    convert slide to image
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSLF
          Assignee: dev@poi.apache.org
          Reporter: nanoticket2015@hotmail.com
  Target Milestone: ---

Created attachment 35001
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35001&action=edit
ppt slide and generated image

I am using the below code to convert ppt slides to image.

BufferedImage imBuff = new BufferedImage(pgsize.width, (pgsize.height) *
slides.size(), BufferedImage.TYPE_INT_RGB);
Graphics g = imBuff.getGraphics();
Graphics2D graphics = img.createGraphics();
graphics.setRenderingHint(Drawable.FONT_MAP, fontMap);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics.setPaint(TRANSPARENT);
graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
slides.get(i).draw(graphics);
g.drawImage(img, 0, i * (pgsize.height), null);

For some .ppt files, the background appears as black. Does anyone know what is
the reason and how to fix this? I suspect that the office software used to
create the .ppt files might be a factor, but I am not able to confirm.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 61112] Ppt background is black when using Apache POI to convert slide to image

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61112

Andreas Beeker <ki...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
                 OS|                            |All
             Status|NEW                         |RESOLVED

--- Comment #2 from Andreas Beeker <ki...@apache.org> ---
see comment #1

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 61112] Ppt background is black when using Apache POI to convert slide to image

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61112

--- Comment #1 from Andreas Beeker <ki...@apache.org> ---
Created attachment 35005
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35005&action=edit
Full Rendering sample

Thanks for uploading your file from your stackoverflow question [1]
I wasn't too far off with my guess there - the culprit seems to be the
background transparency.
I don't think, we should by default not support background transparency,
therefore you might want to add those 3 lines to modify the transparent parts,
 before writing the image (taken from [2]) ... and use a ARGB colormodel.

I'm closing this now as "won't fix" - feel free to reopen and convince me/us
from the opposite ...

[1] https://stackoverflow.com/questions/43973460
[2] https://stackoverflow.com/questions/36030307

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org