public static int[][] getRed(BufferedImage in){
		int width = in.getWidth();
		int height = in.getHeight();
		int[][] red = new int[height][width];
		try {
			

			

			int[] data = new int[width * height];
			
			
			in.getRGB(0, 0, width, height, data, 0, width);

			for (int i = 0; i < height; i++) {
				for (int j = 0; j < width; j++) {
					red[i][j] = ((data[i*height + j] >> 16) & 0xff);
				}
			}

			writeToTextFile(red,"red");

		} catch (Exception e) {
			System.err.println("Error: " + e);
		}
		
		return red;
	
	}