Click here to Skip to main content
15,887,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
//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];
       }


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.


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
Posted
Updated 1-Nov-14 4:42am
v2

1 solution

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.
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."
 
Share this answer
 
v2
Comments
Richard.Berry100 1-Nov-14 10:46am    
Hi Bill. Thanks for your reply (And caution!!) The C# link, unfortunately does not decode the MakerNotes. The other links led me to some other source, but it was Java, and the executables would not run on my machine. But I could not find how they actually extracted the MakerNotes. I have update the question a bit with some of the info you pointed me to.
BillWoodruff 1-Nov-14 21:42pm    
If I have time today, I'll try out the C# solution from D. Noakes to see what it does (anything ?). It appears to me that on-going discussion of Noakes' software is here:

https://groups.google.com/forum/?fromgroups#!forum/metadata-extractor-dev

I wonder if dPreview, might have some content on Canon MakerNotes.

good luck, Bill
Richard.Berry100 2-Nov-14 1:57am    
Thanks Bill. If you are referring to the Java App by D Noaks (Converted to C# by Ferret Renaud) - Pretty hectic. I cant make head or tail of it, and cant seem to get an output from the command line. It does however seem like if I could extract parts of this, it would work for my application. I browsed around DPReview a but, and only came accross an app called Thumber, but did not find anything about reading tags from code
BillWoodruff 2-Nov-14 2:27am    
I keep thinking, given how many Canon cameras there are, and how many programmers :) ... there must be somewhere on-line where someone put usable code to decipher MakerNotes for Canon ! What about commercial software: wonder what LightRoom, or ACDC, etc. can do in terms of maker/model-specific MakerNotes ?

This site suggests there can be model difference in the MakerNotes structure, for example, the D30:

http://www.burren.cx/david/canon.html
Richard.Berry100 2-Nov-14 4:00am    
It must be out there somewhere...

It does seem as though different Cannon models have a different MakerNotes. This site has quite a large number of Camera Specific tags for various Canon models.

http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html

What I'm just not getting is that they all start with Tag 0 or Tag 1 - suggesting that these tags are within the MakerNotes blob of data.

I posted a dump of the makernotes data (7600 Bytes) on Stack Overflow:

http://stackoverflow.com/questions/26696074/read-makernote-exif-tag-in-c-sharp/26696961#26696961

But this blob of data does not seem to conform to the IDF hearder format:
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

Pg 13/14.. in http://www.kodak.com/global/plugins/acrobat/en/service/digCam/exifStandard2.pdf

As far as commercial apps go, I'm new to photography, so the app I'm busy with is intended to view the images, see settings used where results were good/bad, and then move or copy the images to keep into a separate folder, delete the bad ones - basically analyse and sort, and perhaps later rate...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900