2011-04-20 51 views
2

在以下代碼中,我的源圖像的dpi爲600,但結果圖像的dpi將爲96,爲什麼?JAI.create中的DPI更改...爲什麼?

RenderedOp source = JAI.create("fileload", "img/1.jpg"); 

FileOutputStream outputStream = new FileOutputStream("img/new1.jpg"); 
JAI.create("encode", source, outputStream, "JPEG", null); 
JAI.create("filestore", source, "img/new1.jpg", "JPEG", null); 

回答

0

我找到了解決辦法:

ImageInputStream iis = ImageIO.createImageInputStream(new File("img/1.jpg")); 
ImageOutputStream ios = ImageIO.createImageOutputStream(new File("img/new1.jpg")); 

Integer b = null; 
while ((b = iis.read()) != -1) { 
    ios.write(b); 

}