ImageIO.wtrie生成jpg图片质量损失方案:BufferedImage生成jpg图片文件流

     Iterator<ImageWriter> iterator = ImageIO.getImageWritersByFormatName("jpeg");  
        ImageWriter imageWriter = iterator.next();  
        ImageWriteParam imageWriteParam = imageWriter.getDefaultWriteParam();  
        imageWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);  
        imageWriteParam.setCompressionQuality(1);  
 
        imageWriter.setOutput(imageOutput);  
        IIOImage iio_image = new IIOImage(image, null, null);  
        imageWriter.write(null, iio_image, imageWriteParam);  
        imageWriter.dispose();

 

posted @ 2014-09-03 23:50  rubekid  阅读(3373)  评论(0编辑  收藏  举报