通过更新其元数据或 EXIF 信息来旋转图像
我正在开发图像处理实用程序。要求是通过更新其元数据(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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这必须使用手动过程来完成,而不是 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
据我了解,您不希望实际转换图像并旋转其像素数据,而是“显示”它旋转的数据。
我以前从未考虑过这个问题,也不熟悉 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>
你可以
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