grazie mille!
ho trovato anche questa:
codice:Public Shared Sub MakeImageGrayscale(ByVal bmp As Bitmap) Dim cMatrix As New ColorMatrix(New Single()() _ {New Single() {0.299, 0.299, 0.299, 0, 0}, _ New Single() {0.587, 0.587, 0.587, 0, 0}, _ New Single() {0.114, 0.114, 0.114, 0, 0}, _ New Single() {0, 0, 0, 1, 0}, _ New Single() {0, 0, 0, 0, 1}}) Dim imageAttrib As New ImageAttributes imageAttrib.SetColorMatrix(cMatrix) Dim gr As Graphics = Graphics.FromImage(bmp) 'Apply the grayscale image attribute gr.DrawImage(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height), _ 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, imageAttrib) gr.Dispose() End Sub![]()

Rispondi quotando