static void writeImage(
		final File file,
		final PolygonChromosome chromosome,
		final int width,
		final int height
	) {
		final double MIN_SIZE = 500;
		final double scale = max(max(MIN_SIZE/width, MIN_SIZE/height), 1.0);
		final int w = (int)round(scale*width);
		final int h = (int)round(scale*height);

		try {
			final BufferedImage image = new BufferedImage(w, h, TYPE_INT_ARGB);
			final Graphics2D graphics = image.createGraphics();
			chromosome.draw(graphics, w, h);

			ImageIO.write(image, "png", file);
		} catch (IOException e) {
			throw new UncheckedIOException(e);
		}
	}
Command line version of the Evolving images example.
jenetics.example/src/main/java/io/jenetics/example/image/EvolvingImagesCmd.java