Java - ZoomIN Image


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.