[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
Medium Priority
222 Views
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
Question by:swtiley
• 2

LVL 96

Expert Comment

ID: 13716371
0

LVL 32

Expert Comment

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)
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

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

Using:

Imports System.drawing
Imports System.drawing.imaging
0

LVL 1

Author Comment

ID: 13722550

Cheers
Steve
0

## Featured Post

Question has a verified solution.

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

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…
###### Suggested Courses
Course of the Month18 days, left to enroll