Java-缩放图像

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java-缩放图像相关的知识,希望对你有一定的参考价值。

  1. public BufferedImage zoomIn(BufferedImage bi, int scale)
  2. {
  3. int width = scale * bi.getWidth();
  4. int height = scale * bi.getHeight();
  5.  
  6. BufferedImage biScale = new BufferedImage(width, height, bi.getType());
  7.  
  8. // Cicla dando un valore medio al pixel corrispondente
  9. for(int i=0; i<width; i++)
  10. for(int j=0; j<height; j++)
  11. biScale.setRGB(i, j, bi.getRGB(i/scale, j/scale));
  12.  
  13. return biScale;
  14. }

以上是关于Java-缩放图像的主要内容,如果未能解决你的问题,请参考以下文章