ini Listing Program
Public Class Form1
Dim gambar2
As Bitmap
Private Sub Btnhijau_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnhijau.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 = 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 Btnhjau_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnhjau.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 = gambar2.GetPixel(Pc, Pb).R
+ 10
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 Btngray_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btngray.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 Bntmerah_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Bntmerah.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 = 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
Vb >= 255 Then Vb = 255
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 Btnmrah_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnmrah.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 = 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
Vb <= 0 Then Vb = 0
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 Btnrotate_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnrotate.Click
Dim Pb, Pc As Integer
Dim Vm,
Vh, Vb As Double
gambar2 = New
Bitmap(PictureBox2.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 Btnbrigness_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnbrigness.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 = 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 Btnbrgness_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnbrgness.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 = 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 Btnegatif_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnegatif.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
Vb <= 0 Then Vb = 0
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 Btnselesai_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnselesai.Click
End
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
End Class
ini hasil program warna -hijau
ini hasil program warna Rotate
ini hasil program warna Negatif
ini hasil program warna grayscale
Tidak ada komentar:
Posting Komentar