Bonjour,
En passant sur le site, j'ai vu ta question.
(Je suis d'habitude en vb.net)
Je ne sais pas si tu peux le convertir .
Bonne soirée CGSI3
Public Function MakeImageGrayscale() As Bitmap
' Auteur: Inconnu But: Methode pour Convertir une image en niveau de gris
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)
MakeImageGrayscale = Bitmap.Clone
Dim gr As Graphics = Graphics.FromImage(MakeImageGrayscale) ' Apply the grayscale image attriBute
gr.DrawImage(MakeImageGrayscale, New Rectangle(0, 0, MakeImageGrayscale.Width, MakeImageGrayscale.Height), 0, 0, MakeImageGrayscale.Width, MakeImageGrayscale.Height, GraphicsUnit.Pixel, imageAttrib)
gr.Dispose()
End Function