从Image EXIF数据中提取MakerNotes [英] Extract MakerNotes from Image EXIF data

查看:378
本文介绍了从Image EXIF数据中提取MakerNotes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取有关照片的信息。



EXIF标签提供了大量信息,但有一个名为MakerNotes的标签。



Makernotes是Exif Tag 37500.



I am trying to get information about a photo.

EXIF tags provide a fair amount of information, however there is a Tag called MakerNotes.

Makernotes is Exif Tag 37500.

//MakerNotes 37500
       public byte[] GetMakerNotes()
       {
           try
           {
               PropertyItem propItem = image.GetPropertyItem(37500);
               byte[] pv0 = propItem.Value;

               return pv0;
           }
           catch (Exception e)
           {
               if (e.GetType().ToString() != "System.ArgumentNullException")
               {
               }
           }
           return new byte[0];
       }





上面返回一个字节数组。



我如何获得制作笔记中的标签?



JEITA规格说:





Above returns a byte array.

How do I get the tags within makernotes?

The JEITA spec says:

4.6.2 IFD Structure
The IFD used in this standard consists of a 2-byte count (number of fields), 12-byte field Interoperability arrays, and
4-byte offset to the next IFD, in conformance with TIFF Rev. 6.0.
Each of the 12-byte field Interoperability consists of the following four elements respectively.
Bytes 0-1 Tag
Bytes 2-3 Type
Bytes 4-7 Count
Bytes 8-11 Value Offset
Each element is explained briefly below. For details see TIFF Rev. 6.0.

Tag
Each tag is assigned a unique 2-byte number to identify the field. The tag numbers in the Exif 0th IFD and 1st IFD
are all the same as the TIFF tag numbers.
Type
The following types are used in Exif:
1 = BYTE An 8-bit unsigned integer.,
2 = ASCII An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL.,
3 = SHORT A 16-bit (2-byte) unsigned integer,
4 = LONG A 32-bit (4-byte) unsigned integer,
5 = RATIONAL Two LONGs. The first LONG is the numerator and the second LONG expresses the
denominator.,
7 = UNDEFINED An 8-bit byte that can take any value depending on the field definition,
9 = SLONG A 32-bit (4-byte) signed integer (2's complement notation),
10 = SRATIONAL Two SLONGs. The first SLONG is the numerator and the second SLONG is the
denominator.
Count
The number of values. It should be noted carefully that the count is not the sum of the bytes. In the case of one
value of SHORT (16 bits), for example, the count is '1' even though it is 2 bytes.
Value Offset
This tag records the offset from the start of the TIFF header to the position where the value itself is recorded. In
cases where the value fits in 4 bytes, the value itself is recorded. If the value is smaller than 4 bytes, the value is
stored in the 4-byte area starting from the left, i.e., from the lower end of the byte offset area. For example, in big
endian format, if the type is SHORT and the value is 1, it is recorded as 00010000.H.
Note that field Interoperability shall be recorded in sequence starting from the smallest tag number. There is no
stipulation regarding the order or position of tag value (Value) recording.





但是查看返回的数据从上面的代码片段来看,这是没有意义的



上面的代码片段返回了大约7600字节,这里是前几个的示例:





However looking at the data returned from the code snippet above, this is not making sense

The code snippet above returned about 7600 bytes, here is a sample of the first few:

39	0	1	0	3	0	49	0	0	0	104	5	0	0	2	0	3	0	4	0	0	0	202	5	0	0	3	0	3	0	4	0	0	0	210	5	0	0	4	0	3

推荐答案

快速搜索C#免费(可下载,可用源代码)MakerNote佳能读者:[ ^ ]。从代码的快速扫描中我的第一印象是,编写解析器并非易事。



您可能知道,该标签是为制造商保留的,并且它的格式由相机制造商决定;您提供的链接没有关于该标签的信息:
A quick search turned up a C# free (downloadable, source code available) MakerNote reader for Canon: [^]. My first impression, from a quick scan of the code, is that writing a parser is not trivial.

As you may know, that tag is reserved for manufacturers, and its format is left up to the camera manufacturer; the link you provide has no information about that tag:
TIFF Tag MakerNote

IFD		Exif
Code		37500 (hex 0x927C)
Name		MakerNote
Type		UNDEFINED
Count		N
Default		None
Description

Manufacturer specific information.

A tag for manufacturers of Exif writers to record any desired information. The contents are up to the manufacturer, but this tag should not be used for any other than its intended purpose.

您可以在此处找到有关佳能MakerNote格式的信息:[ ^ ],这里:[ ^ ]。



请注意操作时的注意事项TIFF格式的Exif信息:[ ^

You can find information on Canon's MakerNote format here:[^], and here: [^].

Note this caution on manipulating Exif information in TIFF format: [^

"Most vendors write the makernote in TIFF format, i.e., in the same format as the rest of the Exif information is encoded. This appears to be a sensible thing at first glance. Unfortunately, in general it means that any change of an Exif tag, which moves the makernote field, will corrupt it. It is an inherent problem of the TIFF format that a writer must know the format and all extensions used, in order to be able to write changes correctly; unknown tags are potentially corrupted when they are moved (rearranged). But since makernotes are usually proprietary, Exif writers often don't know these details. The reason to write to the Exif data could be as simple as to add copyright information, an Exif comment, etc. Some camera manufacturers seem to have recognized this problem and now use a modified TIFF format with offsets relative to somewhere at the beginning of the makernote field for the makernote IFD to address the issue."


这篇关于从Image EXIF数据中提取MakerNotes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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