C#图片处理之:旋转图片90度的整数倍
2007-11-10 18:54
211 查看
旋转图片90的整数倍那真是太简单了。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public static Bitmap KiRotate90(Bitmap img)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return img;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
很容易就看出来,关键在于RotateFlipType参数。
实践结果如下:
顺时针旋转90度 RotateFlipType.Rotate90FlipNone
逆时针旋转90度 RotateFlipType.Rotate270FlipNone
水平翻转 RotateFlipType.Rotate180FlipY
垂直翻转 RotateFlipType.Rotate180FlipX
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public static Bitmap KiRotate90(Bitmap img)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return img;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
很容易就看出来,关键在于RotateFlipType参数。
实践结果如下:
顺时针旋转90度 RotateFlipType.Rotate90FlipNone
逆时针旋转90度 RotateFlipType.Rotate270FlipNone
水平翻转 RotateFlipType.Rotate180FlipY
垂直翻转 RotateFlipType.Rotate180FlipX
相关文章推荐
- C#图片处理之:旋转图片90度的整数倍 .
- C#图片处理之:旋转图片90度的整数倍
- C#图片处理之:旋转图片90度的整数倍
- C#图片处理之:旋转图片90度的整数倍
- C#图片处理之:旋转图片90度的整数倍
- C#图片处理之:旋转图片90度的整数倍
- 关于android中调用系统拍照,返回图片是旋转90度的处理
- H5技术完美实现调用手机摄像头、相册。图片上传base64,图片压缩、预览、删除以及图片旋转90度的处理--demo。
- LeetCode -- 顺时针旋转图片90度
- Uri android 选择图片或拍照时旋转了90度问题
- opencv 图片旋转90度
- UIImage图片处理,旋转、截取、平铺、缩放等操作
- php旋转图片90度的方法
- SWT图片处理(大小缩放,透明,置灰,旋转,反色)
- iOS开发- 相机(摄像头)获取到的图片自动旋转90度解决办法
- UIImage图片处理,旋转、截取、平铺、缩放等操作
- iOS- 相机(摄像头)获取到的图片自动旋转90度解决办法
- java处理图片--图片的缩放,旋转和马赛克化
- android 选择图片或拍照时旋转了90度问题
- C#中基于GDI+(Graphics)图像处理系列之文字或者图片水印(透明、任意角度旋转)