How do you get a Sepia Tone

Hey I have a question does anyone know how to convert a greyscale image into a sepia toned image. I have been trying to figure out how to get it, but it is not working, either I just get a grey scale, or I get a purple image.

In Photoshop:

Image > Adjustments > Photo Filter > Select Sepia.

I am talking about an algorithm to create a sepia tone, I am trying to create a photoshop like program, and one of the filters I am trying to get is sepia tone.

Hmm… Another Photoshop competitor?? I hope you’re a REALLY “smartkid” :stuck_out_tongue: