battle programmers alliance

battle programming a forum for elite programmers with extreme will power to sharpen theire skills
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Share | 
 

 vb.net mirror an image

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin
avatar

Posts : 52
Join date : 2011-08-01

PostSubject: vb.net mirror an image   Sun Jan 08, 2012 7: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
Back to top Go down
View user profile http://yotamarker.justforum.net
 
vb.net mirror an image
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» How do I make the login popup show an Image, instead of it's bland colors
» Roster image
» The header image keeps going invisible.
» Tiling image behind banner on PhpBB?
» How do you copy image URLs?

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: