webp-imageio
webp-imageio copied to clipboard
Compression size
trafficstars
Hi, i'am trying to use the lib to automaticaly convert jpg files to webp to obtain smaller files. My problem is that the output file is the same weight even if it smaller in size (I previously resized the picture).

I'am doing this under Windows system with this code :
ImageWriter writer = ImageIO.getImageWritersByMIMEType("image/webp").next();
WebPWriteParam writeParam = new WebPWriteParam(writer.getLocale());
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
writeParam.setCompressionType(writeParam.getCompressionTypes()[WebPWriteParam.LOSSLESS_COMPRESSION]);
writer.setOutput(new FileImageOutputStream(outputFile));
writer.write(null, new IIOImage(bufferedImage, null, null), writeParam);
And the original file

You won't get good results with WebPWriteParam.LOSSLESS_COMPRESSION, it means WebP can't really compress much.