Java - ZoomOUT image


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



Copy this code and paste it in your HTML
  1. public BufferedImage zoomOut(BufferedImage bi, int scale)
  2. {
  3. int width = bi.getWidth() / scale;
  4. int height = bi.getHeight() / scale;
  5.  
  6. BufferedImage biScale = new BufferedImage(width, height, bi.getType());
  7.  
  8. for(int i=0; i<width; i++)
  9. for(int j=0; j<height; j++)
  10. biScale.setRGB(i, j, bi.getRGB(i*scale, j*scale));
  11.  
  12. return biScale;
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.