public static BufferedImage invertImage(Image img) {
		BufferedImage bufImg = convert(img);

		for (int j = 0; j < bufImg.getHeight(); j++) {
			for (int i = 0; i < bufImg.getWidth(); i++) {
				int values = bufImg.getRGB(i, j);
				Color oldColor = new Color(values);

				int red = oldColor.getRed();
				int green = oldColor.getGreen();
				int blue = oldColor.getBlue();

				Color newColor = new Color(255 - red, 255 - green, 255 - blue);

				bufImg.setRGB(i, j, newColor.getRGB());
			}
		}
		return bufImg;
	}