有人可以帮助更正此代码吗?
我正在使用JAI
,我正在尝试将 JPG 文件压缩为无损这是我的代码
`ImageWriter writer= (JPEGImageWriter) ImageIO.getImageWritersByFormatName("jpeg").next();
javax.imageio.plugins.jpeg.JPEGImageWriteParam param = (JPEGImageWriteParam)
writer.getDefaultWriteParam();
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param.setCompressionType("JPEG-LOSSLESS");`
这部分总是错误的 param.setCompressionType("JPEG-LOSSLESS");
,错误是java.lang.IllegalArgumentException: Unknown compression type!
at javax.imageio.ImageWriteParam.setCompressionType(ImageWriteParam.java:1023)