C# 获取图像的旋转角度

public static int readPictureDegree(string path)
{
int rotate = 0;
using (var image = System.Drawing.Image.FromFile(path))
{
foreach (var prop in image.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;
}

————————————————
版权声明:本文为CSDN博主「Jayzai」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/jayzai/article/details/50332913

posted @ 2019-12-23 12:03  秋风__萧瑟  阅读(1137)  评论(0编辑  收藏  举报