Rotate Image

Posted on 2008-11-05
Last Modified: 2009-02-12
looking for simple way to rotate an image (tif file usually) using
I am playing with RotateFlip and that I dont think is what I am looking for... not saving a file that will open up.

Any help you can give me is appreciated.
Question by:NTGuru705
    LVL 62

    Expert Comment

    by:Fernando Soto
    What exactly do you want to accomplish?
    LVL 9

    Accepted Solution

    Here is a walkthrough on rotating an image around its center in .net:

    Also, here is an example of rotating or flipping an image from a file:

    ''' <summary>
    ''' Rotates and/or flips an image from a file.
    ''' </summary>
    ''' <param name="imgPath">The path of the image you'd like to flip.</param>
    ''' <param name="savePath">The path of the flipped image you'd like to save to.</param>
    ''' <param name="rotFlipType">The RotateFlipType enum to flip or rotate the image.</param>
    ''' <param name="imgFormat">The format to save the file to.</param>
    ''' <remarks></remarks>

    Public Sub rotFlipImageFromFile(ByRef imgPath As String, ByRef savePath As String, _
    ByRef rotFlipType As RotateFlipType, ByRef imgFormat As System.Drawing.Imaging.ImageFormat)
        Dim img As System.Drawing.Image
        img = System.Drawing.Bitmap.FromFile(imgPath)
        ' We delete the file if it exists so it doesn't fail.
        If System.IO.File.Exists(savePath) Then System.IO.File.Delete(savePath)
        img.Save(savePath, imgFormat)
    End Sub

    ' Example usage of the snippet:
    rotFlipImageFromFile("c:\lol.gif", "c:\lol.gif", RotateFlipType.RotateNoneFlipXY, _

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now