gpt4 book ai didi

c# - 无论如何旋转图像-90度

转载 作者:太空宇宙 更新时间:2023-11-03 19:59:04 25 4
gpt4 key购买 nike

我正在使用 rotateflip 旋转图像并保存在服务器上这是代码:

using (Image image = Image.FromFile(HttpContext.Current.Server.MapPath("~/Content/Job_Files/" + Job_ID + "/" + new_str + "/Images/" + path)))
{
//rotate the picture by 90 degrees and re-save the picture as a Jpeg
if (cbox_id == "cboxRight")
{
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
else
{
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
image.Save(new_path, System.Drawing.Imaging.ImageFormat.Jpeg);
image.Dispose();
}

单击右旋转图像在右侧旋转但左旋转不起作用..如何旋转它??

最佳答案

if 语句的两个分支都包含以下行:

image.RotateFlip(RotateFlipType.Rotate90FlipNone);

所以,除非有一些严肃的魔法在发生,否则它们都会做完全相同的事情。

其中一个应该可能是:

image.RotateFlip(RotateFlipType.Rotate270FlipNone);

(旋转总是顺时针,所以旋转 270 等同于旋转 -90)。

关于c# - 无论如何旋转图像-90度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30392978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com