private void save(BufferedImage image, String fileName, String ext) {
		 String dirName;
		 
		 if(parent != null && parent.parent != null && parent.parent.parent != null){
			 dirName = parent.parent.parent.directoryName;
		 }else{
			 dirName = ".";
		 }
		 
	        File file = new File(dirName + "/" + fileName + "." + ext);
	        
	        try {
	        	ByteArrayOutputStream tmp = new ByteArrayOutputStream();
	            ImageIO.write(image, ext, file);  // ignore returned boolean
	        } catch(IOException e) {
	            System.out.println("Write error for " + file.getPath() +
	                               ": " + e.getMessage());
	        }
	    }