通过更新其元数据或 EXIF 信息来旋转图像

发布于 2024-11-30 22:26:48 字数 72 浏览 1 评论 0原文

我正在开发图像处理实用程序。要求是通过更新其元数据(exif 信息)来旋转图像。我也尝试过做同样的事情但没有成功。请提出一些建议?

I am working on an Image Manipulation utility. The requirement is to rotate the image by updating its metadata (exif information). I have tried to do the same but not succeeded. Kindly suggest some pointers ?

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

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

发布评论

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

评论(2

给妤﹃绝世温柔 2024-12-07 22:26:48

这必须使用手动过程来完成,而不是 EXIF 数据。

我所说的手动是指移动像素。您可以在线找到有关如何使用帮助程序类(可能是 .NET Framework)执行此操作的示例,具体取决于您正在开发的平台。

示例: http://www.switchonthecode.com/tutorials/csharp-tutorial -图像编辑旋转

This is going to have to be done using a manual process, not EXIF data.

By manual I mean moving pixels around. You can find examples online of how to do this using helper classes, perhaps the .NET Framework depending on what platform you are developing on.

Example: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-rotate

岁月静好 2024-12-07 22:26:48

据我了解,您不希望实际转换图像并旋转其像素数据,而是“显示”它旋转的数据。

我以前从未考虑过这个问题,也不熟悉 EXIF 等。但我的脑海中浮现出这一点。

在浏览器中显示方向

真正棘手的部分是在浏览器中显示它。

以下是一些讨论在浏览器中遵循方向的功能请求:

firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=298619

镀铬:
http://code.google.com/p/chromium/issues/ detail?id=56845

我还没有完全阅读这些请求,所以我不确定它们的确切状态,但可能会让您感兴趣。

获取 EXIF 数据

如果浏览器不支持内置 EXIF 方向(可能不支持),首先您需要获取 EXIF 数据,您可以通过查看以下内容来执行此客户端操作从服务器提取的原始二进制数据...

但我猜在服务器端执行会容易得多。

这是用于获取 EXIF 数据的 c# 库 http://www.codeproject.com/KB /graphics/exifextractor.aspx 诚然我没有找到它,这里讨论过:如何使用 C# 从文件中获取 EXIF 数据< /a>

你可以

  • 通过服务器端代码手动旋转它(实际上是操纵像素 - 可能有很多库来做到这一点,可能内置于.net中)
  • 使用Flash旋转它(事实上我认为flash也许能够直接读取EXIF)
  • 使用HTML 画布旋转(也许使用jquery旋转或类似的东西)

From what I understand, you do not wish to actually transform the image and roatate it's pixel data, but instead "display" it rotated.

I've never thought about this before and not familier with EXIF etc. But of the top of my head.

Displaying the orientation in the browser

The really tricky bit is going to be displaying it in the browser.

Here are a couple of feature requests discussing adhearing to orientation in browsers:

firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=298619

chrome:
http://code.google.com/p/chromium/issues/detail?id=56845

I haven't read these requests fully, so I'm not sure exactly of their status, but could be interseting reading for you.

Getting EXIF data

If the browser doesn't support built in EXIF orientation (which it probably doesn't), first you need to get ahold of the EXIF data, you could do this client side by looking at the raw binary data being pulled from the server...

But I'm guessing doing it server-side would be much easier.

Here is a c# library for getting EXIF data http://www.codeproject.com/KB/graphics/exifextractor.aspx Admitadly I didn't find it, it was discussed here: How to get the EXIF data from a file using C#

You could either

  • Rotate it manually via server side code (actually manipulating the pixels - probably loads of libraries to do this, probably built into .net)
  • Using Flash rotate it (infact I think flash maybe able to read EXIF directly)
  • Using the HTML canvas to rotate (maybe using jquery rotate or something similar)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文