簡體   English   中英

如何在不降低dpi分辨率的情況下降低圖像分辨率?

[英]how to reduce the resolution to an image without loose dpi?

我有以下課程

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

但最終結果是,我的dpi丟失了1.如何保持圖像中的dpi?

Dpi是每英寸點數的縮寫,表示圖像的質量。 因此,當您更改圖像的分辨率時,您將以該圖像的原始大小放寬圖像的dpi(每英寸點數)(因為會降低質量!)。 因此, 這是不可能的!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM