Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to rotate an image in .net
Please suggest some code

thanks in advance
Posted
Comments
Sandeep Mewara 2-Jul-12 10:41am    
What have you tried so far?

1 solution

Write in aspx page.
ASP.NET
<asp:Button ID="Button1" runat="server"  Text="Button" onclick="Button1_Click2" />

Write in code behind page
VB
// get the URL of image
string path = Server.MapPath(Image1.ImageUrl) ;
// creating image from the image url
System.Drawing.Image i = System.Drawing.Image.FromFile(path);
// rotate Image 90' Degree
i.RotateFlip( System.Drawing.RotateFlipType.Rotate90FlipXY);
// save it to its actual path
i.Save(path);
// release Image File
i.Dispose();
// Set Image Control Attribute property to new image(but its old path)
Image1.Attributes.Add("ImageUrl", path);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900