Page 1 sur 1

[SOLVED] Image couleur ver nb

Publié : sam. 20/juil./2019 14:07
par microdevweb
Bonjour,

quelqu’un connait'il une méthode, pour afficher une image couleur en nb, ou convertir une image couleur en nb.

Merci

J'ai trouvé voici la solution

Code : Tout sélectionner

Procedure ImageGrayout(image)
  Protected w, h, x, y, r, g, b, gray, color
 
  w = ImageWidth(image)
  h = ImageHeight(image)
  StartDrawing(ImageOutput(image))
  For x = 0 To w - 1
    For y = 0 To h - 1
      color = Point(x, y)
      r    = Red(color)
      g    = Green(color)
      b    = Blue(color)
      gray = 0.2126*r + 0.7152*g + 0.0722*b
      Plot(x, y, RGB(gray, gray, gray))
    Next
  Next
  StopDrawing()
EndProcedure

Re: [SOLVED] Image couleur ver nb

Publié : sam. 20/juil./2019 15:37
par SPH
Pourquoi pas ceci ? :

Code : Tout sélectionner

Procedure ImageGrayout(image)
  Protected w, h, x, y, r, g, b, gray, color

  w = ImageWidth(image)
  h = ImageHeight(image)
  StartDrawing(ImageOutput(image))
  For x = 0 To w - 1
    For y = 0 To h - 1
      color = Point(x, y)
      r    = Red(color)
      g    = Green(color)
      b    = Blue(color)
      gray = (r+g+b)/3
      Plot(x, y, RGB(gray, gray, gray))
    Next
  Next
  StopDrawing()
EndProcedure