now supports grayscale images