public static Image openImage(String filename)
    {

        String extension = null;

        try
        {
            int index_of_extension = filename.lastIndexOf(".");
            extension = filename.substring(index_of_extension);

            if(extension.equalsIgnoreCase(".gif") )
            {
                return openGIF(filename);
            }
            else if(extension.equalsIgnoreCase(".jpg") || extension.equalsIgnoreCase("jpeg") )
            {
                return openJPG(filename);
            }
            else if(extension.equalsIgnoreCase(".bmp") )
            {
                return openBMP(filename);
            }
            else if(extension.equalsIgnoreCase(".pgm") )
            {
                return openPGM(filename);
            }
            else if(extension.equalsIgnoreCase(".ppm") )
            {
                return openPPM(filename);
            }
            else
            {
                // System.out.println("Unsupported file type");
            }
        }
        catch(Exception e)
        {
            // System.out.println("Error!!" + e.toString());
        }

        // Put a message here
        return null;
    }