图片旋转 - RotateImg
2017-02-26 15:36:54 访问(1609) 赞(0) 踩(0)
/// <summary>
/// 图片旋转 - RotateImg
/// </summary>
/// <param name="sourceFileName"></param>
/// <param name="rotateFlipTypeValue"></param>
public static void RotateImg
(
string sourceFileName,
System.Drawing.RotateFlipType rotateFlipTypeValue
)
{
RotateImg
(
sourceFileName,
sourceFileName,
rotateFlipTypeValue
);
}
/// <summary>
/// 图片旋转 - RotateImg
/// </summary>
/// <param name="sourceFileName"></param>
/// <param name="outputFileName"></param>
/// <param name="rotateFlipTypeValue"></param>
public static void RotateImg
(
string sourceFileName,
string outputFileName,
System.Drawing.RotateFlipType rotateFlipTypeValue
)
{
if (sourceFileName == null || sourceFileName.Length == 0)
throw new Exception("sourceFileName == null || sourceFileName.Length == 0");
if (!File.Exists(sourceFileName))
throw new Exception("string sourceFileName[" + sourceFileName + "]文件不存在");
if (outputFileName == null || outputFileName.Length == 0)
throw new Exception("outputFileName == null || outputFileName.Length == 0");
Bitmap userimage = null;
try
{
userimage = new Bitmap(sourceFileName);
userimage.RotateFlip(rotateFlipTypeValue);
userimage.Save(outputFileName);
}
catch (Exception err)
{
throw err;
}
finally
{
if (userimage != null)
userimage.Dispose();
}
}
标签:
图片旋转 - RotateImg 


上一条:
下一条:
相关评论
发表评论