Converting a photo to sepia is a relatively easy effect.
For each pixel in the image, we first convert the pixel to greyscale. We then add a value to the green component, and double that value to the red component to give the sepia effect.
The depth of the sepia effect is determined by this value, which we pass here as the depth parameter. A value of 0 will give a standard greyscale image.
In the above image a depth value of 20 was used.
Here is the function to do this:
Sub ApplySepia(Byref pic as picture, depth as Integer) Dim R As Integer Dim G As Integer Dim B As Integer Dim pixelColor As Color Dim picRGB as RGBSurface picRGB = pic.RGBSurface For y As Integer = 0 To pic.Height - 1 For x As Integer = 0 To pic.Width - 1 pixelColor = picRGB.Pixel(x, y) R = (0.299 * pixelColor.Red) + (0.587 * pixelColor.Green) + (0.114 * pixelColor.Blue) B = R G = B R = R + (depth * 2) If R > 255 Then R = 255 End If G = G + depth If G > 255 Then G = 255 End If picRGB.Pixel(x, y) = RGB(R,G,B) Next Next End Sub