DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Java - ZoomIN Image

  • submit to reddit
public BufferedImage zoomIn(BufferedImage bi, int scale)
		int width = scale * bi.getWidth();
		int height = scale * bi.getHeight();
		BufferedImage biScale = new BufferedImage(width, height, bi.getType());
                // Cicla dando un valore medio al pixel corrispondente
		for(int i=0; i<width; i++)
			for(int j=0; j<height; j++)
				biScale.setRGB(i, j, bi.getRGB(i/scale, j/scale));
		return biScale;