diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java index be2a1bef1..7adc8bbd3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ImageImporter.java @@ -106,6 +106,24 @@ public class ImageImporter extends TagImporter { public Tag importImageAlpha(ImageTag it, byte[] newData) throws IOException { + try { + BufferedImage img = ImageHelper.read(newData); + int width = img.getWidth(); + int height = img.getHeight(); + byte[] data = new byte[width * height]; + int[] imgData = img.getRGB(0, 0, width, height, null, 0, width); + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int alpha = (imgData[y * width + x] >> 24) & 0xff; + data[y * width + x] = (byte) alpha; + } + + } + + newData = data; + } catch (IOException ex) { + } + if (it instanceof DefineBitsJPEG3Tag) { ((DefineBitsJPEG3Tag) it).setImageAlpha(newData); } else if (it instanceof DefineBitsJPEG4Tag) { diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 642b1c874..6bc02d348 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -80,12 +80,14 @@ import java.awt.Component; import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; +import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.io.StringReader; import java.io.StringWriter; @@ -1137,7 +1139,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel //Inject Loader if (swf.isAS3() && Configuration.autoOpenLoadedSWFs.get() && !Configuration.internalFlashViewer.get() && !DebuggerTools.hasDebugger(swf)) { SWF instrSWF; - try (FileInputStream fis = new FileInputStream(tempFile)) { + try (InputStream fis = new BufferedInputStream(new FileInputStream(tempFile))) { instrSWF = new SWF(fis, false, false); }