Admin Admin


Posts : 140 Join date : 2011-08-01
 | Subject: vb.net mirror an image Sun Jan 08, 2012 2:02 pm | |
| the following program will make a mirror image for example if the picture has a doll with an earing on her right ear the mirror image will show the earing on her left ear. this also can creat mirror text as leonardo devince used controls : 2 picture boxes btnInput OpenFileDialog1 label1 label2 property visible set to false SaveFileDialog1 btnSave - Code:
-
Public Class Form1 Dim bitmap1 As Bitmap Private Sub btnInput_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInput.Click Try OpenFileDialog1.ShowDialog() Label2.Visible = False Label2.Text = Nothing Dim fs As IO.FileStream = New IO.FileStream(OpenFileDialog1.FileName, IO.FileMode.Open) bitmap1 = Image.FromStream(fs) fs.Close() PictureBox1.Image = bitmap1 Dim bmts As New Bitmap(bitmap1.Width, bitmap1.Height) For W = 1 To bitmap1.Width - 1 For H = 1 To bitmap1.Height - 1 bmts.SetPixel(W, H, bitmap1.GetPixel(bitmap1.Width - W, H)) Next Next PictureBox2.Image = bmts Catch ex As Exception MsgBox("select an input path picture file") End Try End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load OpenFileDialog1.FileName = Nothing SaveFileDialog1.FileName = Nothing SaveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp" End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Try SaveFileDialog1.ShowDialog() Label1.Text = SaveFileDialog1.FileName Dim bmts As New Bitmap(PictureBox2.Image) Dim bitmapToSave As New Bitmap(bmts) bitmapToSave.Save(SaveFileDialog1.FileName, Imaging.ImageFormat.Bmp) Label2.Text = "image mirroring completed" Label2.Visible = True Catch ex As Exception MsgBox("error") End Try End Sub End Class _________________ kurayami no kagi  | |
|