public void makeBiLevelWithThreshold()
	{
		makeGrayScale();
		int colorCount = 0;
		int[] rgb = new int[3];
		
		for(int y = 0; y < height; y++)
		{
			for(int x = 0; x < width; x++)
			{
				getPixel(x, y, rgb);
				colorCount += rgb[0];
			}
		}
		int average = colorCount / (width * height);
		
		for(int y = 0; y < height; y++)
		{
			for(int x = 0; x < width; x++)
			{
				getPixel(x, y, rgb);
				
				if (rgb[0] > average)
				{
					rgb[0] = rgb[1] = rgb[2] = 255;
					setPixel(x, y, rgb);
				} else if (rgb[0] <= average)
				{
					rgb[0] = rgb[1] = rgb[2] = 0;
					setPixel(x, y, rgb);
				}
			}
		}
		
	}