You start by asking a half-decent question (did you just see Yes, or did you bother to read the link underneath it).
I mean, have you actually "tried" anything at all?
What format is your data? How do you intend to map that to a gray scale?
Which OS are you using? what compiler?
All sorts of information you could clarify to help us to help you.
What we're NOT going to do is write a complete application for you "blind" only for you to say something like
- i found it somewhere else
- that's too complicated
- what does "some trivial statement" do?