.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;
}