我使用并改编了this code。
这是我的代码:
using (MagickImage image = new MagickImage(strNewFileNameWithExtention))
{
var profile = image.GetExifProfile();
switch (dir)
{
case eRotateDirection.Clockwise90Degrees:
{
image.Rotate(90);
break;
}
case eRotateDirection.Counterclockwise90Degrees:
{
image.Rotate(-90);
break;
}
case eRotateDirection.AutoOrient:
{
image.AutoOrient();
break;
}
default:
{
throw new Exception("Invalid rotation direction.");
}
}
profile.SetValue(ExifTag.Orientation, (UInt16)0);
image.Quality = 100;
image.Write(strImagePath);
}
我的代码写入了新的图像文件,但是它们在Chrome中无法正确显示。 任何帮助,不胜感激!