[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is it possible to rotate a graphic image

Posted on 2005-04-06
4
Medium Priority
?
222 Views
Last Modified: 2010-04-23
I suppose this could be a very simple task, that i simply do not have the understanding of - but is it possible to (or does anyone know how to) rotate an image. (e.g. a jpeg) through a set number of degrees (not necessarily 90, 180, 270 though, but an arbitary amount)

Any help would be very much appreciated, as I am complete stumped.

Thanks
   Steve...
0
Comment
Question by:swtiley
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13716371
0
 
LVL 32

Expert Comment

by:Erick37
ID: 13722475
Simple example of how to rotate a picture and display it in a picturebox:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Load up an image from disk
        Dim imgOrig As Image = Image.FromFile("c:\image.jpg")
        'Make a copy
        Dim imgClone As Image = imgOrig.Clone

        'Angle of rotation in degrees
        Dim angle As Single
        angle = 33

        'Create the graphics object to draw onto
        Dim g As Graphics = Graphics.FromImage(imgOrig)
        'Clear the picture and give us a black background
        g.Clear(Color.Black)

        'Translate to the center of the image
        g.TranslateTransform(imgClone.Width / 2, imgClone.Height / 2)
        'Rotate about center of image
        g.RotateTransform(angle)
        'Translate back
        g.TranslateTransform(-imgClone.Width / 2, -imgClone.Height / 2)

        'Draw the image
        g.DrawImage(imgClone, New Point(0, 0))
        'Display the results in a PictureBox
        PictureBox1.Image = imgOrig.Clone

        'clean up
        imgClone.Dispose()
        imgOrig.Dispose()
        g.Dispose()
       
    End Sub
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 2000 total points
ID: 13722482
Forgot this...

Using:

Imports System.drawing
Imports System.drawing.imaging
0
 
LVL 1

Author Comment

by:swtiley
ID: 13722550
Thanks Erick - fantastic answer

Cheers
   Steve
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

831 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