Below is a simple Java program using BufferedImage to create a mosaic image. This example assumes you have a directory full of small images that you want to combine into a mosaic.
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class MosaicCreator
private List<BufferedImage> images;
private int tileWidth;
private int tileHeight;
public MosaicCreator(String directory, int tileWidth, int tileHeight) throws IOException
this.tileWidth = tileWidth;
this.tileHeight = tileHeight;
this.images = new ArrayList<>();
File dir = new File(directory);
for (File file : dir.listFiles()) file.getName().endsWith(".png"))
BufferedImage img = ImageIO.read(file);
BufferedImage scaledImg = scaleImage(img, tileWidth, tileHeight);
images.add(scaledImg);
private BufferedImage scaleImage(BufferedImage image, int width, int height)
BufferedImage newImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
newImage.getGraphics().drawImage(image, 0, 0, width, height, null);
return newImage;
public void createMosaic(String outputFile, int width, int height) throws IOException
BufferedImage mosaic = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
int x = 0, y = 0;
for (int i = 0; i < (width * height) / (tileWidth * tileHeight); i++)
BufferedImage img = images.get(i % images.size()); // Simple reuse, can be improved
mosaic.getGraphics().drawImage(img, x, y, null);
x += tileWidth;
if (x >= width)
x = 0;
y += tileHeight;
ImageIO.write(mosaic, "png", new File(outputFile));
public static void main(String[] args) throws IOException
MosaicCreator creator = new MosaicCreator("path/to/images", 50, 50);
creator.createMosaic("mosaic.png", 500, 500);
Online
Accessibility
This example will guide you through creating a simple mosaic image from a set of smaller images. dass341mosaicjavhdtoday02282024021645 min hot
Gather the small images you want to use for your mosaic. These should be similar in size or easily resizable to a uniform size.
Shooting
Sound
Editing
Color & VFX
Archival & Metadata
Ensure you have Java Development Kit (JDK) installed on your computer. You can download it from https://www.oracle.com/java/technologies/javase-downloads.html.
A 45-minute HD mosaic of intersecting lives and environments in a city under heat: rooftop vendors, late-night musicians, a cooling-center volunteer, a scientist mapping surface temperatures, and an experimental dancer whose choreography visualizes thermal patterns. Fragmented vignettes and layered soundscapes simulate the way heat accumulates, radiates, and distorts memory.