public class MosaicExample public static void main(String[] args) // Load an image BufferedImage img = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB); // Create a mosaic effect for (int x = 0; x < img.getWidth(); x += 10) for (int y = 0; y < img.getHeight(); y += 10) int pixel = img.getRGB(x, y); // Create a small square of the same color for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) if (x + i < img.getWidth() && y + j < img.getHeight()) img.setRGB(x + i, y + j, pixel);