.netrotateflip减少文件大小

发布于 2024-10-19 06:22:30 字数 434 浏览 4 评论 0原文

我有一小段代码来旋转图像

Sub RotateImage(ByVal FilePath As String)
    Dim img = System.Drawing.Image.FromFile(FilePath)
    img.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone)
    img.Save("c:\test.jpg", ImageFormat.Jpeg)
    img.Dispose()
End Sub

由于某种原因,新图像是 758kb,而不是原始图像的 1.69 mb。

这是为什么?我该如何解决这个问题?

我不想压缩图像,只是旋转它。

除此之外,我比较了win explorer中的属性,它们似乎都是相同的,包括分辨率。那么到底发生了什么?

I have a short snippet of code to rotate an image

Sub RotateImage(ByVal FilePath As String)
    Dim img = System.Drawing.Image.FromFile(FilePath)
    img.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone)
    img.Save("c:\test.jpg", ImageFormat.Jpeg)
    img.Dispose()
End Sub

For some reason, the new image is 758kb instead of 1.69 mb as the original.

Why is this and how can I fix this?

I do not want to compress the image, just rotate it.

other then that, I compared the properties in win explorer, and they all seem to be identical, including resolution. so what is actually happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

比忠 2024-10-26 06:22:30

可能是因为图像被重新编码。我在文档中看不到任何内容 RotateFlip 应该是无损的。

通过 Google 进行快速浏览可以得到 这篇文章您可以尝试一下。

Probably because the image is recoded. I can not see anything in the documentation saying that RotateFlip should be lossless.

A quick tour with Google gives this article that you might try.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文