title: Brightness/exposure function with vb .net
body: <p>I'm making a simple image editor in VB.NET, and one of the functions is brightness/ exposure.</p>
  
  <p>this is how I'm doing it:</p>
  
  <pre><code>For i = 0 To img.Width - 1
      For j = 0 To img.Height - 1
          Dim s As Color = img.GetPixel(i, j)
  
          Dim r As Integer = s.R * 2
          Dim g As Integer = s.G * 2
          Dim b As Integer = s.B * 2
          If s.R * 2 &gt; 255 Then
              r = 255
          End If
  
          If s.G * 2 &gt; 255 Then
              g = 255
          End If
          If s.B * 2 &gt; 255 Then
              b = 255
          End If
          Dim x As Color = Color.FromArgb(255, r, g, b)
          img.SetPixel(i, j, x)
  
      Next
  Next
  </code></pre>
  
  <p>where 2  is brightness which makes it twice as bright.</p>
  
  <p>Only problem is this doesnt seem to work well because it does it, but takes about 30 seconds!
  What am I doing wrong? is there a better way to implement it?</p>
  
  <p>Thanks</p>