" Assalammu'alaikum warahmatullahi wabarakatuh "
Ya elah jumpa lagi padahal dah gk post lagi hehehe,langsung saja kita ke TKP nya
Public Class Form1
Dim gambar2 As Bitmap
Private Sub grayscale_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grayscale.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R
vh = gambar2.GetPixel(pc, pb).G
vb = gambar2.GetPixel(pc, pb).B
rt = (vm + vh + vb) / 3
gambar2.SetPixel(pc, pb, Color.FromArgb(rt, rt, rt))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox2.Image = PictureBox1.Image
End Sub
Private Sub hijaukurang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hijaukurang.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R
vh = gambar2.GetPixel(pc, pb).G - 10
vb = gambar2.GetPixel(pc, pb).B
If vh <= 0 Then vh = 0
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub hijautambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hijautambah.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R
vh = gambar2.GetPixel(pc, pb).G + 10
vb = gambar2.GetPixel(pc, pb).B
If vh >= 255 Then vh = 255
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub merahkurang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles merahkurang.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R - 10
vh = gambar2.GetPixel(pc, pb).G
vb = gambar2.GetPixel(pc, pb).B
If vm <= 0 Then vm = 0
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub merahtambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles merahtambah.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R + 1000
vh = gambar2.GetPixel(pc, pb).G
vb = gambar2.GetPixel(pc, pb).B
If vm >= 255 Then vm = 255
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub birutambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R
vh = gambar2.GetPixel(pc, pb).G
vb = gambar2.GetPixel(pc, pb).B + 10
If vb >= 255 Then vb = 255
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub brignestambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles brignestambah.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R + 5
vh = gambar2.GetPixel(pc, pb).G + 5
vb = gambar2.GetPixel(pc, pb).B + 5
If vm >= 255 Then vm = 255
If vh >= 255 Then vh = 255
If vb >= 255 Then vb = 255
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub kurangbrignes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kurangbrignes.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = gambar2.GetPixel(pc, pb).R - 5
vh = gambar2.GetPixel(pc, pb).G - 5
vb = gambar2.GetPixel(pc, pb).B - 5
If vm <= 0 Then vm = 0
If vh <= 0 Then vh = 0
If vb <= 0 Then vb = 0
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
Private Sub rotate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rotate.Click
Dim pb, pc As Integer
Dim rt, vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox1.Image)
Dim gambar3 As Bitmap = New Bitmap(PictureBox1.Image)
For pb = gambar2.Height - 1 To 0 Step -1
For pc = gambar2.Width - 1 To 0 Step -1
vm = gambar2.GetPixel(pc, pb).R
vh = gambar2.GetPixel(pc, pb).G
vb = gambar2.GetPixel(pc, pb).B
gambar3.SetPixel(gambar2.Width - 1 - pc, gambar2.Height - 1 - pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar3
'PictureBox2.Refresh()
Next
End Sub
Private Sub negative_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles negative.Click
Dim pb, pc As Integer
Dim vm, vh, vb As Double
gambar2 = New Bitmap(PictureBox2.Image)
For pb = 0 To gambar2.Height - 1
For pc = 0 To gambar2.Width - 1
vm = 255 - gambar2.GetPixel(pc, pb).R
vh = 255 - gambar2.GetPixel(pc, pb).G
vb = 255 - gambar2.GetPixel(pc, pb).B
If vm <= 0 Then vm = 0
If vh <= 0 Then vh = 0
If vb <= 0 Then vb = 0
gambar2.SetPixel(pc, pb, Color.FromArgb(vm, vh, vb))
Next
PictureBox2.Image = gambar2
PictureBox2.Refresh()
Next
End Sub
End Class

Tidak ada komentar:
Posting Komentar