Live Chat Icon For mobile
Live Chat Icon

How to rotate a image in ASP.NET

Platform: ASP.NET| Category: GDI+


Dim img As System.Drawing.Image
Dim strFilename As String = Server.MapPath('curves1.jpg')
img = System.Drawing.Image.FromFile(strFilename)
Dim b = New System.Drawing.Bitmap(img.Width, img.Height, PixelFormat.Format24bppRgb)
Dim g As Graphics = Graphics.FromImage(b)
g.DrawImage(img, New Point(0, 0))
Response.ContentType = 'image/jpeg'
b.Save(Response.OutputStream, ImageFormat.Jpeg)


System.Drawing.Image img ;   
string strFilename = Server.MapPath('curves1.jpg')  ;
img = System.Drawing.Image.FromFile(strFilename) ; 
Bitmap b = new System.Drawing.Bitmap(img.Width, img.Height, PixelFormat.Format24bppRgb)  ;
Graphics  g    = Graphics.FromImage(b)  ;
img.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipXY)  ;
g.DrawImage(img,new Point(0,0))  ;
Response.ContentType='image/jpeg'  ;
b.Save(Response.OutputStream, ImageFormat.Jpeg)  ;

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.