static Image rgbToGrayUsingGrayFilter(Image img) {
  GrayFilter filter = new(true, 50);  
  FilteredImageSource imageSource = new(img.getSource(), filter);  
  ret awtToolkit().createImage(imageSource);  
}