public void readFile() throws FileNotFoundException {
		File inFile = new File(fileName);
		Scanner in = new Scanner(inFile);
		
		// Check for the header, the right format of specifying the width, 
		// height and the color instance. If all ok, proceed with the reading 
		// RGB components.
		try {
			String header = in.next();
			if (!checkHeader(header)) {
				in.close();
				throw new IllegalArgumentException();

			}
			width = Integer.parseInt(in.next());
			height = Integer.parseInt(in.next());
			int colorInstance = Integer.parseInt(in.next());
			if (colorInstance != COLORINSTANCE) {
				in.close();
				throw new IllegalArgumentException();
			}
			
			while (in.hasNext()) {
				r = Integer.parseInt(in.next());
				g = Integer.parseInt(in.next());
				b = Integer.parseInt(in.next());
				
				// If successfully read in the RGB components, add the color to
				// the array list.
				Color c = new Color(r, g, b);
				colorList.add(c);
			}
		} catch (IllegalArgumentException e) {
			System.out.println("File format error.");
		} catch (Exception e) {
			System.out.println("Unknown error occurred.");
		}
		
		// Traverse through the colorList array and set the pixel for the canvas
		// object. I am trying to figure out a better way to improve efficiency.
		// Using a triple loop slow down the program. 
		int i = 0;
		canvas = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
		while (i < colorList.size()) {
			for (int j = 0; j < height; j++) {
				for (int k = 0; k < width; k++) {
					canvas.setRGB(k, j, colorList.get(i).getRGB());
					i++;
				}
			}

		}
		in.close();
	}