webp4j icon indicating copy to clipboard operation
webp4j copied to clipboard

java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3

Open ghost opened this issue 3 years ago • 0 comments

HI,

Im not able to convert any PNG to WEBP but JPEG works fine for me. Code is simple:

BufferedImage image = ImageIO.read(inputStream); return Webp4j.encode(image, WEBP_QUALITY);

as mention before, if i put a JPEG in the inputstream, it converts fine, but when I try with PNG, it throws an error: Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3 at java.desktop/java.awt.image.ComponentSampleModel.getPixel(ComponentSampleModel.java:744) ~[na:na] at java.desktop/java.awt.image.Raster.getPixel(Raster.java:1605) ~[na:na] at com.zakgof.webp4j.BITools.scan(BITools.java:24) ~[webp4j-0.0.2.jar!/:na] at com.zakgof.webp4j.Webp4j.encode(Webp4j.java:23) ~[webp4j-0.0.2.jar!/:na]

ghost avatar Jun 29 '22 12:06 ghost