diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-11-04 21:24:21 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-11-04 21:24:21 +0000 |
commit | b27bb4f41338c5d9374d1d9c89439c456017d6d9 (patch) | |
tree | 3440d1fd424e05b0f3dbe4aff7b5f1a07e086359 | |
parent | 150fb90cc2320b1e879038c199eedcc1c4ca4376 (diff) | |
download | poi-b27bb4f41338c5d9374d1d9c89439c456017d6d9.tar.gz poi-b27bb4f41338c5d9374d1d9c89439c456017d6d9.zip |
Jpeg can't be processed with alpha channel
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1883129 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java b/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java index 093eb87f52..a33a85344b 100644 --- a/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java +++ b/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java @@ -42,7 +42,17 @@ public class BitmapFormat implements OutputFormat { @Override public Graphics2D addSlide(double width, double height) { - img = new BufferedImage((int)width, (int)height, BufferedImage.TYPE_INT_ARGB); + int type; + switch (format) { + case "png": + case "gif": + type = BufferedImage.TYPE_INT_ARGB; + break; + default: + type = BufferedImage.TYPE_INT_RGB; + break; + } + img = new BufferedImage((int)width, (int)height, type); graphics = img.createGraphics(); graphics.setRenderingHint(Drawable.BUFFERED_IMAGE, new WeakReference<>(img)); return graphics; |