]> source.dussan.org Git - poi.git/commitdiff
Jpeg can't be processed with alpha channel
authorAndreas Beeker <kiwiwings@apache.org>
Wed, 4 Nov 2020 21:24:21 +0000 (21:24 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Wed, 4 Nov 2020 21:24:21 +0000 (21:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1883129 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java

index 093eb87f526ad0dbc3e2000e5a51f9c8fdb1c86c..a33a85344b6939955e4193b0563ed42899192a46 100644 (file)
@@ -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;