getDefaultWriteParam metodou
Şöyle yaparız
Şöyle yaparız.
Şöyle yaparız
Şöyle yaparız
ImageWriteParam iwp = writer.getDefaultWriteParam();
setOutput meetoduŞöyle yaparız.
ImageOutputStream os = new FileImageOutputStream(new File(filenamepath));
ImageWriter jpgWriter = ImageIO.getImageWritersByFormatName("jpg").next();
ImageWriteParam jpgWriteParam = jpgWriter.getDefaultWriteParam();
jpgWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
jpgWriteParam.setCompressionQuality(1f);
jpgWriter.setOutput(os);
write metoduŞöyle yaparız
BufferedImage bi = ...;
ImageWriter writer = ...;
ImageWriteParam iwp = ...;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedOutputStream bos = new java.io.BufferedOutputStream(baos);
ImageOutputStream ios = ImageIO.createImageOutputStream(bos);
writer.setOutput(ios);
IIOImage optimizedImage = new IIOImage(bi, null, null);
writer.write(null, optimizedImage, iwp);
writer.dispose();
baos.flush();
Hiç yorum yok:
Yorum Gönder