Da Picture Colorata a Picture Gray o B&W

Ho una Picture colorata vorrei trasformala in Grigio o Bianco e Nero per poterla poi salvare su un Database e Stamparla ,
come posso fare ??


There will be faster and better methods.
(and MBS plugins)
But a basic solution …?

for x as integer = 0 to img.width-1
    for y as integer = 0 to img.height-1
    var v as integer = img.rgbsurface.pixel(x,y).value * 255
    img.rgbsurface(x,y) = rgb(v,v,v)