JAI中的DPI变化。创建......为什么?

时间:2011-04-20 19:11:17

标签: java image-processing resolution dpi jai

在下面的代码中,我的源图像的dpi为600,但结果图像的dpi为96,为什么?

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); 

1 个答案:

答案 0 :(得分: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);

}