working for grey  scale images!