我有下面的课程
public void resize(InputStream input, OutputStream output, int width, int height) throws IOException {
BufferedImage src = ImageIO.read(input);
BufferedImage dest = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = dest.createGraphics();
AffineTransform at = AffineTransform.getScaleInstance((double)width / src.getWidth(), (double)height / src.getHeight());
g.drawRenderedImage(src, at);
ImageIO.write(dest, "tif", output);
output.close();
}但在最终结果中,我在1处丢失了dpi。我如何才能将dpi保留在图像中?
发布于 2016-08-22 14:11:59
Dpi是每英寸点数的缩写,返回到图像的质量。因此,当你改变一个图像的分辨率时,你会失去该图像的原始尺寸的dpi (每英寸点数)(因为你失去了质量!)。因此,这是不可能的!
https://stackoverflow.com/questions/38948509
复制相似问题