Canon Makernotes and byte ordering

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: helmut, XnTriq, xnview

Post Reply
CameronD
Posts: 311
Joined: Wed Aug 01, 2007 1:28 pm
Location: Australia

Canon Makernotes and byte ordering

Post by CameronD »

Hi,
I have a situation where makernotes are not being displayed by XnView in images I manipulate with exiftool - I saw it first in v1.99.4, and it is the same in v1.99.5.

background:
For panoramas, I shoot raw (Canon EOS), convert to 16-bit tiff, run through Hugin, Photoshop and then finally save as jpeg.
Just for completion, I like to have fixed data, such as lens, exposure conditions, ISO stored in the exif data for the final image.

I use the following command in exiftool to copy over the information I want:

Code: Select all

exiftool -tagsFromFile <input> -MakerNotes  -make -model -Exif:GPS -Exif:ExposureTime -Exif:FNumber ...etc... -Exif:WhiteBalance <output>
Now, this seems to work fine if I use exiftool to view the resulting metadata but XnView just shows an empty block of makernotes.
The problem stems from the fact that Photoshop (I use the CS1 version) always swaps to big-endian byte ordering for jpegs.
Using exiftools htmldump I can see that the various IFD blocks are big-endian, including the ExifIFD, but the makernotes block remains little-endian.

Phil Harvey has made some comments about it in the exiftool forums: where he says exiftool has to rely on some heuristics to determine byte ordering of the makernotes block.

Workaround: I simply use XnView to convert from the final tiff to jpeg. So long as I use a little-endian jpeg there is no problem with XnView understanding the makernotes transfer.

Other info:
Canon's own DPP program can read the makernotes in the jpegs with mixed byte ordering, so perhaps that is a hint that it expects makernotes to always be little endian. Either that, or else they did not even think about it.

JpegSnoop also cannot understand the mixed byte ordering. PhotoME does understand it.

It seems Photoshop-CS5 has changed to using little-endian with save-as jpeg - at least under ms-windows - but I can't afford to keep upgrading :( . And it still strips out makernotes. Hugin also stripped out the makernotes and lens/exposure info from the resulting tiff file.
Last edited by CameronD on Thu Nov 08, 2012 12:27 pm, edited 1 time in total.
User avatar
xnview
Author of XnView
Posts: 46252
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Canon Makernotes and byte ordering

Post by xnview »

could you send me a sample file?
Pierre.
boardhead
Posts: 1
Joined: Wed Nov 07, 2012 1:21 pm
Location: Canada

Re: Canon Makernotes and byte ordering

Post by boardhead »

There is another possible work-around. You could change the EXIF to little-endian with ExifTool. Here is the command line to do this at the same time as copying the other information:

exiftool -all= -tagsfromfile @ -all:all -unsafe -exifbyteorder=little -tagsFromFile <input> -MakerNotes -make -model -GPS:all -Exif:ExposureTime -Exif:FNumber ...etc... -Exif:WhiteBalance <output>

This command will rebuild all metadata in the output image, changing the EXIF byte order to little-endian, then copy the information you want from the input file. ExifTool's FAQ number 20 explains the rebuilding part of this command. (http://owl.phy.queensu.ca/~phil/exiftool/faq.html#Q20)

NOTE: This only works for JPEG images -- ExifTool can't be used to change the byte ordering of TIFF images.

- Phil
CameronD
Posts: 311
Joined: Wed Aug 01, 2007 1:28 pm
Location: Australia

Re: Canon Makernotes and byte ordering

Post by CameronD »

xnview wrote:could you send me a sample file?
Yes, I have some samples reduced in size - less than 2MB total. But the directions in the "bug reporting guidelines" sticky just say send to "image".

I cannot find any button for me to attach files to a post here - not sure if it is disabled in this phpBB, or my post count is too small.
edit: I see if I switch to subsilver2 style that I cannot post attachments - it wasn't visible anywhere I could see using prosilver
Last edited by CameronD on Thu Nov 08, 2012 12:33 pm, edited 1 time in total.
CameronD
Posts: 311
Joined: Wed Aug 01, 2007 1:28 pm
Location: Australia

Re: Canon Makernotes and byte ordering

Post by CameronD »

boardhead wrote:There is another possible work-around. You could change the EXIF to little-endian with ExifTool...
Thanks Phil,
that's useful to know. I checked a few of my older panoramas, when I wasn't trying to be so careful about what got overwritten - I had simply used PhotoME to export/import the entire exif set and in the process that seems to swap the byte ordering as well.

Cameron.
User avatar
xnview
Author of XnView
Posts: 46252
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Canon Makernotes and byte ordering

Post by xnview »

you can send me it on contact at xnview dot com
Pierre.
CameronD
Posts: 311
Joined: Wed Aug 01, 2007 1:28 pm
Location: Australia

Re: Canon Makernotes and byte ordering

Post by CameronD »

done.
Post Reply