Rotate Image

Posted on 2008-11-05
Medium Priority
Last Modified: 2009-02-12
looking for simple way to rotate an image (tif file usually) using vb.net.
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 64

Expert Comment

by:Fernando Soto
ID: 22892630
What exactly do you want to accomplish?

Accepted Solution

unassassinable earned 2000 total points
ID: 22892713
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month16 days, 11 hours left to enroll

864 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