diff --git a/imageio/imageio-webp/src/main/java/com/twelvemonkeys/imageio/plugins/webp/WebPImageReader.java b/imageio/imageio-webp/src/main/java/com/twelvemonkeys/imageio/plugins/webp/WebPImageReader.java index 3135225af..5767ef8f1 100644 --- a/imageio/imageio-webp/src/main/java/com/twelvemonkeys/imageio/plugins/webp/WebPImageReader.java +++ b/imageio/imageio-webp/src/main/java/com/twelvemonkeys/imageio/plugins/webp/WebPImageReader.java @@ -465,6 +465,8 @@ private void readVP8Extended(BufferedImage destination, ImageReadParam param, lo } private void readVP8Extended(BufferedImage destination, ImageReadParam param, long streamEnd, final int width, final int height) throws IOException { + boolean seenALPH = false; + while (imageInput.getStreamPosition() < streamEnd) { int nextChunk = imageInput.readInt(); long chunkLength = imageInput.readUnsignedInt(); @@ -484,6 +486,12 @@ private void readVP8Extended(BufferedImage destination, ImageReadParam param, lo case WebP.CHUNK_VP8_: readVP8(RasterUtils.asByteRaster(destination.getRaster()) .createWritableChild(0, 0, destination.getWidth(), destination.getHeight(), 0, 0, new int[] {0, 1, 2}), param); + + if (header.containsALPH && !seenALPH) { + // May happen for animation frames, if some frames are fully opaque + opaqueAlpha(destination.getAlphaRaster()); + } + break; case WebP.CHUNK_VP8L: