hasil nya
Program nya.
·
Public Class Form1
Dim gambar As Bitmap
Private Sub OpenCitraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenCitraToolStripMenuItem.Click
OFD.Filter = "BMP|*.bmp|JPG|*.Jpg"
OFD.ShowDialog()
Dim gambar As Bitmap
Private Sub OpenCitraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenCitraToolStripMenuItem.Click
OFD.Filter = "BMP|*.bmp|JPG|*.Jpg"
OFD.ShowDialog()
If OFD.FileName
= "" Then Exit Sub
Pic1.Image = Image.FromFile(OFD.FileName)
gambar = New Bitmap(Pic1.Image)
End Sub
Pic1.Image = Image.FromFile(OFD.FileName)
gambar = New Bitmap(Pic1.Image)
End Sub
Private Sub
SaveCitraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SaveCitraToolStripMenuItem.Click
SFD.Filter = "JPG|*.Jpg|BMP|*.bmp"
SFD.ShowDialog()
SFD.Filter = "JPG|*.Jpg|BMP|*.bmp"
SFD.ShowDialog()
If
SFD.FileName = "" Then Exit Sub
If SFD.FilterIndex = 1 Then
gambar.Save(SFD.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
End If
If SFD.FilterIndex = 2 Then
gambar.Save(SFD.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
End If
End Sub
If SFD.FilterIndex = 1 Then
gambar.Save(SFD.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
End If
If SFD.FilterIndex = 2 Then
gambar.Save(SFD.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
End If
End Sub
Private Sub
GrayscaleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GrayscaleToolStripMenuItem.Click
Dim Pb, Pc As Integer
Dim Rt, vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = .GetPixel(Pc, Pb).R
vH = .GetPixel(Pc, Pb).G
vB = .GetPixel(Pc, Pb).B
Rt = (vM + vH + vB) / 3
.SetPixel(Pc, Pb, Color.FromArgb(Rt, Rt, Rt))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Dim Pb, Pc As Integer
Dim Rt, vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = .GetPixel(Pc, Pb).R
vH = .GetPixel(Pc, Pb).G
vB = .GetPixel(Pc, Pb).B
Rt = (vM + vH + vB) / 3
.SetPixel(Pc, Pb, Color.FromArgb(Rt, Rt, Rt))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Private Sub
NegatifToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NegatifToolStripMenuItem.Click
Dim Pb, Pc As Integer
Dim vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = 255 - .GetPixel(Pc, Pb).R
vH = 255 - .GetPixel(Pc, Pb).G
vB = 255 - .GetPixel(Pc, Pb).B
If vM <= 0 Then vM = 0
If vB <= 0 Then vB = 0
If vH <= 0 Then vH = 0
.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Dim Pb, Pc As Integer
Dim vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = 255 - .GetPixel(Pc, Pb).R
vH = 255 - .GetPixel(Pc, Pb).G
vB = 255 - .GetPixel(Pc, Pb).B
If vM <= 0 Then vM = 0
If vB <= 0 Then vB = 0
If vH <= 0 Then vH = 0
.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Private Sub
BrigthnessToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BrigthnessToolStripMenuItem.Click
Dim Pb, Pc As Integer
Dim vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = .GetPixel(Pc, Pb).R + 5
vB = .GetPixel(Pc, Pb).G + 5
vH = .GetPixel(Pc, Pb).B + 5
If vM > 255 Then vM = 255
If vB > 255 Then vB = 255
If vH > 255 Then vH = 255
.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Dim Pb, Pc As Integer
Dim vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = .GetPixel(Pc, Pb).R + 5
vB = .GetPixel(Pc, Pb).G + 5
vH = .GetPixel(Pc, Pb).B + 5
If vM > 255 Then vM = 255
If vB > 255 Then vB = 255
If vH > 255 Then vH = 255
.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Private Sub
DefaultGambarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles DefaultGambarToolStripMenuItem.Click
gambar = New Bitmap(Pic1.Image)
End Sub
gambar = New Bitmap(Pic1.Image)
End Sub
Private Sub
BinerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BinerToolStripMenuItem.Click
Dim Pb, Pc As Integer
Dim rata, vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = .GetPixel(Pc, Pb).R
vH = .GetPixel(Pc, Pb).G
vB = .GetPixel(Pc, Pb).B
rata = (vM + vH + vB) / 3
If (rata < 128) Then
vM = 0
vH = 0
vB = 0
Else
vM = 255
vH = 255
vB = 255
End If
.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Dim Pb, Pc As Integer
Dim rata, vM, vH, vB As Double
With gambar
For Pb = 0 To .Height - 1
For Pc = 0 To .Width - 1
vM = .GetPixel(Pc, Pb).R
vH = .GetPixel(Pc, Pb).G
vB = .GetPixel(Pc, Pb).B
rata = (vM + vH + vB) / 3
If (rata < 128) Then
vM = 0
vH = 0
vB = 0
Else
vM = 255
vH = 255
vB = 255
End If
.SetPixel(Pc, Pb, Color.FromArgb(vM, vH, vB))
Next
Pic2.Image = gambar
Pic2.Refresh()
Next
End With
End Sub
Private Sub
RotateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RotateToolStripMenuItem.Click
End Sub
Private Sub
KeluarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles KeluarToolStripMenuItem.Click
End
End Sub
End
End Sub
Private Sub
ToolStripToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ToolStripToolStripMenuItem.Click
Dim gambar2 = New Bitmap(Pic2.Image)
gambar2 = New Bitmap(Pic2.Image)
gambar2.RotateFlip(RotateFlipType.Rotate270FlipY)
Pic2.Image = Gambar2
End Sub
Dim gambar2 = New Bitmap(Pic2.Image)
gambar2 = New Bitmap(Pic2.Image)
gambar2.RotateFlip(RotateFlipType.Rotate270FlipY)
Pic2.Image = Gambar2
End Sub
Private Sub
ToolStrip2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ToolStrip2ToolStripMenuItem.Click
Dim gambar2 = New Bitmap(Pic2.Image)
gambar2 = New Bitmap(Pic2.Image)
gambar2.RotateFlip(RotateFlipType.Rotate90FlipY)
Pic2.Image = gambar2
End Sub
Dim gambar2 = New Bitmap(Pic2.Image)
gambar2 = New Bitmap(Pic2.Image)
gambar2.RotateFlip(RotateFlipType.Rotate90FlipY)
Pic2.Image = gambar2
End Sub
End Class