System.out.println("IllegalStateException");
	ImagePlus openJpegOrGif(String dir, String name) {		System.out.println("Opening JPG");	   	ImagePlus imp = null;		Image img = Toolkit.getDefaultToolkit().getImage(dir+name); 		System.out.println(img);		if (img!=null) { 			try { 				imp = new ImagePlus(name, img); 			} catch (IllegalStateException e) {				System.out.println("IllegalStateException");				return null; // error loading image				 			} 			    	if (imp.getType()==ImagePlus.COLOR_RGB)	    		convertGrayJpegTo8Bits(imp);	    	FileInfo fi = new FileInfo();	    	fi.fileFormat = fi.GIF_OR_JPG;	    	fi.fileName = name;	    	fi.directory = dir;	    	imp.setFileInfo(fi);				    }	    return imp;	}