.net后台用Image获取原图旋转角度

/// <summary>
/// 获取原图旋转角度
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static int readPictureRotate(Image img)
{
int rotate = 0;
foreach (var prop in img.PropertyItems)
{
if (prop.Id == 0x112)
{
if (prop.Value[0] == 6)
rotate = 90;
if (prop.Value[0] == 8)
rotate = -90;
if (prop.Value[0] == 3)
rotate = 180;
prop.Value[0] = 1;
}
}
return rotate;
}

posted @ 2019-07-17 16:18  苹果的味道_Echo  阅读(398)  评论(0编辑  收藏  举报