如何在JPEG编码字节顺序有关系吗? [英] How does JPEG endianness matter on coding?

查看:192
本文介绍了如何在JPEG编码字节顺序有关系吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在对涉及的图片一个大项目。其中一个我遇到的大问题是图像的存储方式(JPEG更清晰)。我总是尽管这在我们的现代世界中,我们没得botter关于这个主题,但现在我不知道。

I'm currently working on a big project that involve pictures. One of the big issues I'm having is with the endianness of the picture (jpeg to be clearer). I always though that in our modern world we didn't have to botter about this subject, but now I'm not sure.

我做的:

  1. 在我做一个HTTP请求到IP摄像机,相机返回我的字节数组。
  2. 在我使用Image.FromStream解析这些字节到.NET中的物体图像。
  3. 在我把我的Image对象,并做了保存到硬盘上的物理文件。

这些照片,然后在另一个模块从我的应用程序,它使用一个第三方的观众是做一些处理到图像使用。观众适用于所有在Windows XP和Windows Vista中使用计算机生成的图像。但是,当使用Windows 7计算机生成的图片,图片是全乱了。

These picture are then use in another module from my application which use a 3rd party "viewer" that do some manipulation to the image. The viewer works with all the picture generated using computer in Windows XP and Windows Vista. But when the picture are generated using a Windows 7 machine, the pictures is all messed up.

让我们说,在Windows XP中创建的图片将被称为PictureXP,并使用Windows 7中创建的画面将被调用图片7 我检查使用exiftools文件,发现有2场是为PictureXP和图片7之间的差异。

Let's say that the picture created with Windows XP will be called PictureXP and the picture created using Windows 7 will be called Picture7 I checked the files using exiftools and discover that there was 2 fields that were different between PictureXP and Picture7.

PictureXP:的Exif字节顺序:小端 图片7:的Exif字节顺序:大端 图片7也有一个附加字段:用户评论:

PictureXP: Exif Byte Order: Little-endian Picture7: Exif Byte Order: Big-endian Picture7 also have an additional field: User Comment: .

这两个画面可以正常打开任何照片浏览器,它只有在这的第三方浏览器,画面显示都混在一起,并在3画面之间的唯一区别是这些领域。

The two pictures can be opened normally in any photo viewer, it's only in this 3rd party viewer that the picture show up all mixed up and the only difference between the 3 pictures are these fields.

我想知道的是什么:

  1. 有没有可能是第三方需要把其它附加code到他的软件,因此需要处理的图片的字节顺序?我想所有的图像节目在那里处理呢?
  2. 是否有可能为我改变我的JP​​EG格式的存储方式是始终little-endian的?我曾经读过一个JPEG文件的内容始终应该是在相同的字节顺序,但似乎它没有考虑到EXIF数据。如果有可能,我希望在.NET ...
  3. 系统解决方案
  4. 在任何可以协助办理这种局面也将被视为一个答案。

非常感谢!

修改1 :我发现这个文章确认在EXIF头发现endiannes只适用于EXIF​​头和一个JPEG文件始终处于大端。那么,有没有办法改变的EXIF标头,这样的第三方软将能够阅读他需要什么?

EDIT 1 : I found this article confirming that the endiannes found in the exif header is only applicable to the exif header and that a jpeg file is always in big-endian. So is there a way to change the exif header so the 3rd party soft would be able to read what he needs?

推荐答案

好了,所以我发现我的答案问问题菲尔的的 exiftool

Ok so I found my answer by asking question to Phil, the author of exiftool

您可以看到我和他这里的线程。

  1. 是的,它是可能的。第三方SDK不知道该EXIF头可以连接使用小端或大端codeD和只阅读使用小端。改变我所有的图片小端解决了这一问题。
  2. 2的部分回答:第一,JPEG的数据总是在我的编辑为表示大端。其次,EXIF头可处于小端还是大端,并有可能使用exiftool去改变它。

在命令行:

exiftool -all = -tagsfromfile test.jpg放在-all:所有-unsafe -exifbyteorder =小尾数test.jpg放在

您也可以找到一个包装的工具,几乎所有的语言在这个

You can also found a wrapper for the tool in almost any language in this page.

非常感谢你对这个问题的兴趣,我收到了答案。

Thanks a lot for your interest in the question and the answer I received.

这篇关于如何在JPEG编码字节顺序有关系吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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