Filter grayscale images