如何旋转图像 [英] how to rotate an image

查看:75
本文介绍了如何旋转图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在.net中旋转图像
请建议一些代码

在此先感谢

How to rotate an image in .net
Please suggest some code

thanks in advance

推荐答案

在aspx页面中编写.
Write in aspx page.
<asp:Button ID="Button1" runat="server"  Text="Button" onclick="Button1_Click2" />


在页面后面编写代码


Write in code behind page

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


这篇关于如何旋转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆