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
This commit is contained in:
Andreas Beeker 2020-11-04 21:24:21 +00:00
parent 150fb90cc2
commit b27bb4f413
1 changed files with 11 additions and 1 deletions

View 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;