public void filterGreyScale(int option){
		if (img == null) return;
		if (option==1){
			ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
			ColorConvertOp op = new ColorConvertOp(cs, null);
			img = op.filter(img, new BufferedImage(img.getWidth(), img.getHeight(),  
				    BufferedImage.TYPE_BYTE_GRAY));
		}
		else{
			ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
			ColorConvertOp op = new ColorConvertOp(cs, null);
			img = op.filter(img, new BufferedImage(img.getWidth(), img.getHeight(),  
				    BufferedImage.TYPE_BYTE_INDEXED));
		}
	}