public synchronized void averageImages() {
		if (history.size() < 1) {
			textArea.append("No images!\n");
			return;
		}
		int[] smallest = smallestIndices();
		int xSize = smallest[0];
		int ySize = smallest[1];
		int size = history.size();
		BufferedImage result = new BufferedImage(xSize, ySize,
				BufferedImage.TYPE_INT_RGB);
		/*
		 * Skips extra pixels (when an image smaller than others) rather than
		 * averaging those...hrm..
		 */
		List<Integer> printed = new ArrayList<Integer>();
		for (int i = 0; i < xSize; i++) {
			printProgress(i, xSize, printed);
			for (int j = 0; j < ySize; j++) {
				int red = 0;
				int blue = 0;
				int green = 0;
				for (BufferedImage b : history) {

					Color pixel = new Color(b.getRGB(i, j));
					red += pixel.getRed();
					blue += pixel.getBlue();
					green += pixel.getGreen();
				}
				Color newColour = new Color(red / size, blue / size, green
						/ size);
				result.setRGB(i, j, newColour.getRGB());
			}
		}
		textArea.append(100 + " % done\n");
		paintImage(result);
	}