Hello,
I'm making a simple image editor in vb .net, and one of the functions is brightness/ exposure.
this is how I'm doing it:
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 > 255 Then
r = 255
End If
If s.G * 2 > 255 Then
g = 255
End If
If s.B * 2 > 255 Then
b = 255
End If
Dim x As Color = Color.FromArgb(255, r, g, b)
img.SetPixel(i, j, x)
Next
Next
where 2 is brightness which makes it twice as bright.
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?
Thanks