问题阅读JPEG元数据(方向) [英] Problem reading JPEG Metadata (Orientation)

查看:395
本文介绍了问题阅读JPEG元数据(方向)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这被带到iPhone上的JPEG图像。在我的台式PC(Windows照片查看器,谷歌Chrome等)的方向不正确。

I've got a JPEG image which was taken on an iphone. On my desktop PC (Windows Photo Viewer, Google Chrome, etc) the orientation is incorrect.

我工作的一个ASP.NET MVC 3 Web应用程序,我需要(目前使用plupload)上传照片。

I'm working on an ASP.NET MVC 3 web application where i need to upload photos (currently using plupload).

我有一些服务器端code处理图像,包括读取EXIF数据。

I've got some server-side code to process images, including reading EXIF data.

我试着读了EXIF元数据的 PropertyTagOrientation 字段(使用GDI - Image.PropertyItems ) ,但该字段不是present。

I've tried reading the PropertyTagOrientation field in the EXIF meta data (using GDI - Image.PropertyItems), but the field isn't present.

因此​​,这两种的一些具体iphone元数据,或一些其它的元数据

So it's either some specific iphone meta data, or some other meta data.

我用像Aurigma照片上传其他工具,并正确读出元数据和旋转图像。它是如何做到这一点?

I've used another tool like Aurigma Photo Uploader, and it reads the meta data correctly and rotates the image. How does it do this?

有谁知道还有什么其他的JPEG元数据可能包含才能知道它需要旋转所需的信息,由Aurigma使用?

Does anyone know what other JPEG meta data could contain the information required in order to know that it needs to be rotated, that is used by Aurigma?

这里的code我使用读取EXIF数据:

Here's the code i'm using to read the EXIF data:

var image = Image.FromStream(fileStream);

foreach (var prop in image.PropertyItems)
{
   if (prop.Id == 112 || prop.Id == 5029)
   {
      // do my rotate code - e.g "RotateFlip"
      // Never get's in here - can't find these properties.
   }
}

任何想法?

推荐答案

看来,你忘了,你抬头看方向ID值是十六进制。在您使用112,你应该使用0x112。

It appears that you forgotten that the orientation id values you looked up are in hex. Where you use 112, you should have used 0x112.

这篇文章解释了如何Windows ballsed朝上方向吊运和<一个href=\"http://www.$c$cproject.com/tips/64116/Using-GDIplus-$c$c-in-a-WPF-application-for-lossle.aspx\">this 之一似乎相关pretty你在做什么。

This article explains how Windows ballsed-up orientation handing, and this one seems pretty relevant to what you are doing.

这篇关于问题阅读JPEG元数据(方向)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆