public static int[][][] writeColorImageValueToFile(BufferedImage in) {
		int width = in.getWidth();
		int height = in.getHeight();

		System.out.println("width=" + width + " height=" + height);
		int[][][] rgb = new int[3][width][height];
		try {
			int[][] b = new int[height][width];
			int[][] c = new int[height][width];
			int[][] d = new int[height][width];
			

			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++) {
					b[i][j] = ((data[i*height + j] >> 16) & 0xff);
					c[i][j] = ((data[i*height + j] >> 8) & 0xff);
					d[i][j] = (data[i*height + j] & 0xff);
				}
			}

			writeToTextFile(b,"red");
			writeToTextFile(c,"green");
			writeToTextFile(d,"blue");
			int[][][] rgbTemp = {b,c,d};
			rgb = rgbTemp;
		} catch (Exception e) {
			System.err.println("Error: " + e);
		}
		
		return rgb;
	}