Skip to content

Instantly share code, notes, and snippets.

@redaktor
Last active August 29, 2015 14:00
Show Gist options
  • Save redaktor/bae0ef2377ab70bc5276 to your computer and use it in GitHub Desktop.
Save redaktor/bae0ef2377ab70bc5276 to your computer and use it in GitHub Desktop.
WIP
var util = require('util');
/* Extracts Canon flavored Makernotes. */
/*
// descriptor tables can be written like so
// [null, 'desc', {desc: 'FocalType', val: {0: 'AF', 1: 'Fixed', 2: 'Zoom'}}]
// or
// { 1:'desc', 2:{desc: 'FocalType', val: {0: 'AF', 1: 'Fixed', 2: 'Zoom'}}}
// which is the same for the map function
*/
/* TODO :
// Powershot not done yet.
// 2 tags are still "undefined", see in ShotInfo and 0x000d: 'CameraInfo'
// and some are big arrays, e.g.
//AFInfo2, ColorData and DustRemovalData !
//? lenses to support LensType (non canon) additional to LensModel (for some consumer cameras) ?
*/
/* some CameraInfo is valid for multiple camera models ... */
exports.identifyCanonCameraInfo = function(model, buffer){
var camIdents = [
{
desc: '1D',
// (save size of this record as 'CameraInfoCount' for later tests)
fn: function(){ return new RegExp(/\b1DS?$/).test(model); }
},
{
desc: '1DmkII',
fn: function(){ return new RegExp(/\b1Ds? Mark II$/).test(model); }
},
{
desc: '1DmkIIN',
fn: function(){ return new RegExp(/\b1Ds? Mark II N$/).test(model); }
},
{
desc: '1DmkIII',
fn: function(){ return new RegExp(/\b1Ds? Mark III$/).test(model); }
},
{
desc: '1DmkIV',
fn: function(){ return new RegExp(/\b1D Mark IV$/).test(model); }
},
{
desc: '1DX',
fn: function(){ return new RegExp(/EOS-1D X$/).test(model); }
},
{
desc: '5D',
fn: function(){ return new RegExp(/EOS 5D$/).test(model); }
},
{
desc: '5DmkII',
fn: function(){ return new RegExp(/EOS 5D Mark II$/).test(model); }
},
{
desc: '5DmkIII',
fn: function(){ return new RegExp(/EOS 5D Mark III$/).test(model); }
},
{
desc: '6D',
fn: function(){ return new RegExp(/EOS 6D$/).test(model); }
},
{
desc: '7D',
fn: function(){ return new RegExp(/EOS 7D$/).test(model); }
},
{
desc: '40D',
fn: function(){ return new RegExp(/EOS 40D$/).test(model); }
},
{
desc: '50D',
fn: function(){ return new RegExp(/EOS 50D$/).test(model); }
},
{
desc: '60D',
fn: function(){ return new RegExp(/EOS 60D$/).test(model); }
},
{
desc: '70D',
fn: function(){ return new RegExp(/EOS 70D$/).test(model); }
},
{
desc: '450D',
fn: function(){ return new RegExp(/\b(450D|REBEL XSi|Kiss X2)\b/).test(model); }
},
{
desc: '500D',
fn: function(){ return new RegExp(/\b(500D|REBEL T1i|Kiss X3)\b/).test(model); }
},
{
desc: '550D',
fn: function(){ return new RegExp(/\b(550D|REBEL T2i|Kiss X4)\b/).test(model); }
},
{
desc: '600D',
fn: function(){ return new RegExp(/\b(600D|REBEL T3i|Kiss X5)\b/).test(model); }
},
{
desc: '650D',
fn: function(){ return new RegExp(/\b(650D|REBEL T4i|Kiss X6i|700D|Rebel T5i|Kiss X7i)\b/).test(model); }
},
{
desc: '1000D',
fn: function(){ return new RegExp(/\b(1000D|REBEL XS|Kiss F)\b/).test(model); }
},
{
desc: '1100D',
fn: function(){ return new RegExp(/\b(1100D|REBEL T3|Kiss X50)\b/).test(model); }
} /*,
{
desc: 'PowerShot',
// valid if format is int32u[138] or int32u[148]
fn: '$format eq 'int32u' and ($count == 138 or $count == 148)'
},
{
desc: 'PowerShot2',
// valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
fn: 'q{ $format eq 'int32u' and ($count == 156 or $count == 162 or $count == 167 or $count == 171 or $count == 264) }'
},
{
desc: 'Unknown32',
fn: '$format =~ /^int32/',
// (counts of 72, 85, 86, 93, 94, 96, 104) - PH
},
{
desc: 'Unknown16',
fn: '$format =~ /^int16/'
} /*,
{
desc: 'Unknown'
} */
];
var c = '';
camIdents.forEach(function(camera){
//console.log( camera.desc, camera.fn() );
if( camera.fn() === true ) c = camera.desc;
});
return c;
}
exports.extractMakernotes = function (data, makernoteOffset, tiffOffset) {
var makernoteData = {};
// List of vendor specific Makernote tags found on
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html
// or
// http://www.exiv2.org/tags-canon.html
var tags = {
0x0001: 'CameraSettings',
0x0002: 'FocalLength',
0x0003: 'CanonFlashInfo',
0x0004: 'ShotInfo',
0x0005: 'Panorama',
0x0006: 'ImageType',
0x0007: 'FirmwareVersion',
0x0008: 'FileNumber',
0x0009: 'OwnerName',
0x000c: 'SerialNumber',
0x000d: 'CameraInfo',
0x000e: 'CanonFileLength',
0x000f: 'CustomFunctions',
0x0010: 'ModelID',
0x0011: 'MovieInfo',
0x0012: 'AFInfo',
0x0013: 'ThumbnailImageValidArea',
0x0015: 'SerialNumberFormat',
0x001a: 'SuperMacro',
0x0024: 'FaceDetect1',
0x0025: 'FaceDetect2',
0x0026: 'AFInfo2',
0x0027: 'ContrastInfo',
0x0028: 'ImageUniqueID',
0x002f: 'FaceDetect3',
0x0035: 'TimeInfo',
0x0083: 'OriginalDecisionDataOffset',
0x00a4: 'WhiteBalanceTable',
0x0095: 'FileInfo',
0x4019: 'LensInfo',
0x0095: 'LensModel',
0x0096: 'InternalSerialNumber',
0x0097: 'DustRemovalData',
0x0099: 'CustomFunctions',
0x00a0: 'ProcessingInfo',
0x00aa: 'MeasuredColor',
0x00b4: 'ColorSpace',
0x00d0: 'VRDOffset',
0x00e0: 'SensorInfo',
0x4001: 'ColorData'
};
var cameras = {
0x1010000: 'PowerShot A30',
0x1040000: 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
0x1060000: 'PowerShot A20',
0x1080000: 'PowerShot A10',
0x1090000: 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
0x1100000: 'PowerShot G2',
0x1110000: 'PowerShot S40',
0x1120000: 'PowerShot S30',
0x1130000: 'PowerShot A40',
0x1140000: 'EOS D30',
0x1150000: 'PowerShot A100',
0x1160000: 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
0x1170000: 'PowerShot A200',
0x1180000: 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
0x1190000: 'PowerShot G3',
0x1210000: 'PowerShot S45',
0x1230000: 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
0x1240000: 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
0x1250000: 'PowerShot A70',
0x1260000: 'PowerShot A60',
0x1270000: 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
0x1290000: 'PowerShot G5',
0x1300000: 'PowerShot A300',
0x1310000: 'PowerShot S50',
0x1340000: 'PowerShot A80',
0x1350000: 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
0x1360000: 'PowerShot S1 IS',
0x1370000: 'PowerShot Pro1',
0x1380000: 'PowerShot S70',
0x1390000: 'PowerShot S60',
0x1400000: 'PowerShot G6',
0x1410000: 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
0x1420000: 'PowerShot A75',
0x1440000: 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
0x1450000: 'PowerShot A400',
0x1470000: 'PowerShot A310',
0x1490000: 'PowerShot A85',
0x1520000: 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
0x1530000: 'PowerShot A95',
0x1540000: 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
0x1550000: 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
0x1560000: 'PowerShot A520',
0x1570000: 'PowerShot A510',
0x1590000: 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
0x1640000: 'PowerShot S2 IS',
0x1650000: 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
0x1660000: 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
0x1668000: 'EOS D60',
0x1700000: 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
0x1740000: 'PowerShot A430',
0x1750000: 'PowerShot A410',
0x1760000: 'PowerShot S80',
0x1780000: 'PowerShot A620',
0x1790000: 'PowerShot A610',
0x1800000: 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
0x1810000: 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
0x1820000: 'PowerShot TX1',
0x1870000: 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
0x1880000: 'PowerShot A420',
0x1890000: 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
0x1900000: 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
0x1920000: 'PowerShot A700',
0x1940000: 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
0x1950000: 'PowerShot S3 IS',
0x1960000: 'PowerShot A540',
0x1970000: 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
0x1980000: 'PowerShot G7',
0x1990000: 'PowerShot A530',
0x2000000: 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
0x2010000: 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
0x2020000: 'PowerShot A710 IS',
0x2030000: 'PowerShot A640',
0x2040000: 'PowerShot A630',
0x2090000: 'PowerShot S5 IS',
0x2100000: 'PowerShot A460',
0x2120000: 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
0x2130000: 'PowerShot A570 IS',
0x2140000: 'PowerShot A560',
0x2150000: 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
0x2160000: 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
0x2180000: 'PowerShot A550',
0x2190000: 'PowerShot A450',
0x2230000: 'PowerShot G9',
0x2240000: 'PowerShot A650 IS',
0x2260000: 'PowerShot A720 IS',
0x2290000: 'PowerShot SX100 IS',
0x2300000: 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
0x2310000: 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
0x2320000: 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
0x2360000: 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
0x2370000: 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
0x2380000: 'PowerShot A590 IS',
0x2390000: 'PowerShot A580',
0x2420000: 'PowerShot A470',
0x2430000: 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
0x2460000: 'PowerShot SX1 IS',
0x2470000: 'PowerShot SX10 IS',
0x2480000: 'PowerShot A1000 IS',
0x2490000: 'PowerShot G10',
0x2510000: 'PowerShot A2000 IS',
0x2520000: 'PowerShot SX110 IS',
0x2530000: 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
0x2540000: 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
0x2550000: 'PowerShot E1',
0x2560000: 'PowerShot D10',
0x2570000: 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
0x2580000: 'PowerShot A2100 IS',
0x2590000: 'PowerShot A480',
0x2600000: 'PowerShot SX200 IS',
0x2610000: 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
0x2620000: 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
0x2630000: 'PowerShot A1100 IS',
0x2640000: 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
0x2700000: 'PowerShot G11',
0x2710000: 'PowerShot SX120 IS',
0x2720000: 'PowerShot S90',
0x2750000: 'PowerShot SX20 IS',
0x2760000: 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
0x2770000: 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
0x2800000: 'PowerShot A495',
0x2810000: 'PowerShot A490',
0x2820000: 'PowerShot A3100 IS / A3150 IS',
0x2830000: 'PowerShot A3000 IS',
0x2840000: 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
0x2850000: 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
0x2860000: 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
0x2870000: 'PowerShot SX210 IS',
0x2880000: 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
0x2890000: 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
0x2920000: 'PowerShot G12',
0x2930000: 'PowerShot SX30 IS',
0x2940000: 'PowerShot SX130 IS',
0x2950000: 'PowerShot S95',
0x2980000: 'PowerShot A3300 IS',
0x2990000: 'PowerShot A3200 IS',
0x3000000: 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
0x3010000: 'PowerShot Pro90 IS',
0x3010001: 'PowerShot A800',
0x3020000: 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
0x3030000: 'PowerShot SX230 HS',
0x3040000: 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
0x3050000: 'PowerShot A2200',
0x3060000: 'PowerShot A1200',
0x3070000: 'PowerShot SX220 HS',
0x3080000: 'PowerShot G1 X',
0x3090000: 'PowerShot SX150 IS',
0x3100000: 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
0x3110000: 'PowerShot S100 (new)',
0x3120000: 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
0x3130000: 'PowerShot SX40 HS',
0x3140000: 'IXY 32S',
0x3160000: 'PowerShot A1300',
0x3170000: 'PowerShot A810',
0x3180000: 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
0x3190000: 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
0x3200000: 'PowerShot D20',
0x3210000: 'PowerShot A4000 IS',
0x3220000: 'PowerShot SX260 HS',
0x3230000: 'PowerShot SX240 HS',
0x3240000: 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
0x3250000: 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
0x3260000: 'PowerShot A3400 IS',
0x3270000: 'PowerShot A2400 IS',
0x3280000: 'PowerShot A2300',
0x3330000: 'PowerShot G15',
0x3340000: 'PowerShot SX50',
0x3350000: 'PowerShot SX160 IS',
0x3360000: 'PowerShot S110 (new)',
0x3370000: 'PowerShot SX500 IS',
0x3380000: 'PowerShot N',
0x3390000: 'IXUS 245 HS / IXY 430F',
0x3400000: 'PowerShot SX280 HS',
0x3410000: 'PowerShot SX270 HS',
0x3420000: 'PowerShot A3500 IS',
0x3430000: 'PowerShot A2600',
0x3450000: 'PowerShot A1400',
0x3460000: 'PowerShot ELPH 130 IS / IXUS 140 / IXY 110F',
0x3470000: 'PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F',
0x3490000: 'PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F',
0x3510000: 'PowerShot A2500',
0x3540000: 'PowerShot G16',
0x3550000: 'PowerShot S120',
0x3560000: 'PowerShot SX170 IS',
0x3580000: 'PowerShot SX510 HS',
0x3590000: 'PowerShot S200 (new)',
0x3600000: 'IXY 620F',
0x3610000: 'PowerShot N100',
0x3640000: 'PowerShot G1 X Mark II',
0x3650000: 'PowerShot D30',
0x3660000: 'PowerShot SX700 HS',
0x3670000: 'PowerShot SX600 HS',
0x3680000: 'PowerShot ELPH 140 IS / IXUS 150',
0x3690000: 'PowerShot ELPH 135 / IXUS 145 / IXY 120',
0x3700000: 'PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630',
0x3710000: 'PowerShot ELPH 150 IS / IXUS 155 / IXY 140',
0x4040000: 'PowerShot G1',
0x6040000: 'PowerShot S100 / Digital IXUS / IXY Digital',
0x4007d673: 'DC19/DC21/DC22',
0x4007d674: 'XH A1',
0x4007d675: 'HV10',
0x4007d676: 'MD130/MD140/MD150/MD160/ZR850',
0x4007d777: 'DC50',
0x4007d778: 'HV20',
0x4007d779: 'DC211',
0x4007d77a: 'HG10',
0x4007d77b: 'HR10',
0x4007d77d: 'MD255/ZR950',
0x4007d81c: 'HF11',
0x4007d878: 'HV30',
0x4007d87c: 'XH A1S',
0x4007d87e: 'DC301/DC310/DC311/DC320/DC330',
0x4007d87f: 'FS100',
0x4007d880: 'HF10',
0x4007d882: 'HG20/HG21',
0x4007d925: 'HF21',
0x4007d926: 'HF S11',
0x4007d978: 'HV40',
0x4007d987: 'DC410/DC411/DC420',
0x4007d988: 'FS19/FS20/FS21/FS22/FS200',
0x4007d989: 'HF20/HF200',
0x4007d98a: 'HF S10/S100',
0x4007da8e: 'HF R10/R16/R17/R18/R100/R106',
0x4007da8f: 'HF M30/M31/M36/M300/M306',
0x4007da90: 'HF S20/S21/S200',
0x4007da92: 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
0x4007dda9: 'HF G25',
0x80000001: 'EOS-1D',
0x80000167: 'EOS-1DS',
0x80000168: 'EOS 10D',
0x80000169: 'EOS-1D Mark III',
0x80000170: 'EOS 300D / Digital Rebel / Kiss Digital',
0x80000174: 'EOS-1D Mark II',
0x80000175: 'EOS 20D',
0x80000176: 'EOS 450D / Digital Rebel XSi / Kiss X2',
0x80000188: 'EOS-1Ds Mark II',
0x80000189: 'EOS 350D / Digital Rebel XT / Kiss Digital N',
0x80000190: 'EOS 40D',
0x80000213: 'EOS 5D',
0x80000215: 'EOS-1Ds Mark III',
0x80000218: 'EOS 5D Mark II',
0x80000219: 'WFT-E1',
0x80000232: 'EOS-1D Mark II N',
0x80000234: 'EOS 30D',
0x80000236: 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
0x80000241: 'WFT-E2',
0x80000246: 'WFT-E3',
0x80000250: 'EOS 7D',
0x80000252: 'EOS 500D / Rebel T1i / Kiss X3',
0x80000254: 'EOS 1000D / Rebel XS / Kiss F',
0x80000261: 'EOS 50D',
0x80000269: 'EOS-1D X',
0x80000270: 'EOS 550D / Rebel T2i / Kiss X4',
0x80000271: 'WFT-E4',
0x80000273: 'WFT-E5',
0x80000281: 'EOS-1D Mark IV',
0x80000285: 'EOS 5D Mark III',
0x80000286: 'EOS 600D / Rebel T3i / Kiss X5',
0x80000287: 'EOS 60D',
0x80000288: 'EOS 1100D / Rebel T3 / Kiss X50',
0x80000297: 'WFT-E2 II',
0x80000298: 'WFT-E4 II',
0x80000301: 'EOS 650D / Rebel T4i / Kiss X6i',
0x80000302: 'EOS 6D',
0x80000324: 'EOS-1D C',
0x80000325: 'EOS 70D',
0x80000326: 'EOS 700D / Rebel T5i / Kiss X7i',
0x80000327: 'EOS 1200D / Rebel T5 / Kiss X70',
0x80000331: 'EOS M',
0x80000346: 'EOS 100D / Rebel SL1 / Kiss X7',
0x80000355: 'EOS M2'
}
var focal = [
{desc: 'FocalType', val: {0: 'AF', 1: 'Fixed', 2: 'Zoom'}}, 'FocalLength', 'FocalPlaneXSize', 'FocalPlaneYSize'
];
var camSettings = [
/* These are valid for all Canon cameras.
// Model specific values can be found below in 'camInfos' and 'references'
*/
{
desc: 'MacroMode',
val: {1: 'Macro', 2: 'Normal'}
},
'SelfTimer',
{
desc: 'Quality',
val: {_:'n/a',0:'n/a', 1:'Economy', 2:'Normal', 3:'Fine', 4:'RAW', 5:'Super Fine', 128: '640x480 Movie', 129: 'Medium Movie', 130:'Normal Movie', 137: '1280x720 Movie', 142: '1920x1080 Movie'}
},
{
desc: 'CanonFlashMode',
val: {_:'n/a',0:'Off', 1:'Auto', 2:'On', 3:'Red-eye reduction', 4:'Slow-sync', 5:'Red-eye reduction (Auto)', 6:'Red-eye reduction (On)', 16:'External flash'}
},
{
desc: 'ContinuousDrive',
val: {0:'Single', 1:'Continuous', 2:'Movie', 3:'Continuous, Speed Priority', 4:'Continuous, Low', 5:'Continuous, High', 6:'Silent Single', 9:'Single, Silent', 10:'Continuous, Silent'}
},
null,
{
desc: 'FocusMode',
val: {0:'One-shot AF', 1:'AI Servo AF', 2:'AI Focus AF', 3:'Manual Focus (3)', 4:'Single', 5:'Continuous', 6:'Manual Focus (6)', 16:'Pan Focus', 256:'AF + MF', 512:'Movie Snap Focus', 519:'Movie Servo AF'}
},
null,
{
desc: 'RecordMode',
val: {1:'JPEG', 2:'CRW+THM', 3:'AVI+THM', 4:'TIF', 5:'TIF+JPEG', 6:'CR2', 7:'CR2+JPEG', 9:'MOV', 10:'MP4'}
},
{
desc: 'CanonImageSize',
val: {0:'Large', 1:'Medium', 2:'Small', 5:'Medium 1', 6:'Medium 2', 7:'Medium 3', 8:'Postcard', 9:'Widescreen', 10:'Medium Widescreen', 14:'Small 1', 15:'Small 2', 16:'Small 3', 128:'640x480 Movie', 129:'Medium Movie', 130:'Small Movie', 137:'1280x720 Movie', 142:'1920x1080 Movie'}
},
{
desc: 'EasyMode',
val: {0:'Full auto', 1:'Manual', 2:'Landscape', 3:'Fast shutter', 4:'Slow shutter', 5:'Night', 6:'Gray Scale', 7:'Sepia', 8:'Portrait', 9:'Sports', 10:'Macro', 11:'Black & White', 12:'Pan focus', 13:'Vivid', 14:'Neutral', 15:'Flash Off', 16:'Long Shutter', 17:'Super Macro', 18:'Foliage', 19:'Indoor', 20:'Fireworks', 21:'Beach', 22:'Underwater', 23:'Snow', 24:'Kids & Pets', 25:'Night Snapshot', 26:'Digital Macro', 27:'My Colors', 28:'Movie Snap', 29:'Super Macro 2', 30:'Color Accent', 31:'Color Swap', 32:'Aquarium', 33:'ISO 3200', 34:'ISO 6400', 35:'Creative Light Effect', 36:'Easy', 37:'Quick Shot', 38:'Creative Auto', 39:'Zoom Blur', 40:'Low Light', 41:'Nostalgic', 42:'Super Vivid', 43:'Poster Effect', 44:'Face Self-timer', 45:'Smile', 46:'Wink Self-timer', 47:'Fisheye Effect', 48:'Miniature Effect', 49:'High-speed Burst', 50:'Best Image Selection', 51:'High Dynamic Range', 52:'Handheld Night Scene', 53:'Movie Digest', 54:'Live View Control', 55:'Discreet', 56:'Blur Reduction', 57:'Monochrome', 58:'Toy Camera Effect', 59:'Scene Intelligent Auto', 60:'High-speed Burst HQ', 61:'Smooth Skin', 62:'Soft Focus', 257:'Spotlight', 258:'Night 2', 259:'Night+', 260:'Super Night', 261:'Sunset', 263:'Night Scene', 264:'Surface', 265:'Low Light 2'}
},
{
desc: 'DigitalZoom',
val: {0:'None', 1:'2x', 2:'4x', 3:'Other'}
},
'Contrast',
'Saturation',
'Sharpness',
'CameraISO',
{
desc: 'MeteringMode',
val: {0:'Default', 1:'Spot', 2:'Average', 3:'Evaluative', 4:'Partial', 5:'Center-weighted average'}
},
{
desc: 'FocusRange',
val: {0:'Manual', 1:'Auto', 2:'Not Known', 3:'Macro', 4:'Very Close', 5:'Close'}
},
'AFPoint',
{
desc: 'CanonExposureMode',
val: {6:'Middle Range', 7:'Far Range', 8:'Pan Focus', 9:'Super Macro', 10:'Infinity'}
},
null,
{
desc: 'LensType',
val: {}
},
'MaxFocalLength',
'MinFocalLength',
'FocalUnits',
'MaxAperture',
'MinAperture',
'FlashActivity',
'FlashBits',
null,
null,
{
desc: 'FocusContinuous',
val: {0:'Single', 1:'Continuous', 8:'Manual'}
},
{
desc: 'AESetting',
val: {0:'Normal AE', 1:'Exposure Compensation', 2:'AE Lock', 3:'AE Lock + Exposure Comp.', 4:'No AE'}
},
{
desc: 'ImageStabilization',
val: {0:'Off', 1:'On', 2:'Shoot Only', 3:'Panning', 4:'Dynamic', 256:'Off (2)', 257:'On (2)', 258:'Shoot Only (2)', 259:'Panning (2)', 260:'Dynamic (2)'}
},
'DisplayAperture',
'ZoomSourceWidth',
'ZoomTargetWidth',
null,
{
desc: 'SpotMeteringMode',
val: {0:'Center', 1:'AF Point'}
},
{
desc: 'PhotoEffect',
val: {0:'Off', 1:'Vivid', 2:'Neutral', 3:'Smooth', 4:'Sepia', 5:'B&W', 6:'Custom', 100:'My Color Data'}
},
'ManualFlashOutput',
{
desc: 'ColorTone',
val: {0:'Normal'}
},
null,
null,
null,
{
desc: 'SRAWQuality',
val: {0:'n/a', 1:'sRAW1 (mRAW) ', 2:'sRAW2 (sRAW)'}
}
];
var shotInfo = [
'AutoISO', /*(actual ISO used = BaseISO * AutoISO / 100)*/
'BaseISO', 'MeasuredEV', 'TargetAperture', 'TargetExposureTime', 'ExposureCompensation',
{ ref: 'WhiteBalance' },
{
desc: 'SlowShutter',
val: {_:'n/a',0:'Off', 1:'Night Scene', 2:'On', 3:'None'}
},
'SequenceNumber', 'OpticalZoomCode', null, 'CameraTemperature', 'FlashGuideNumber',
{
desc: 'AFPointsInFocus',
val: {12288:'None(MF)', 12289:'Right', 12290:'Center', 12291:'Center+Right', 12292:'Left', 12293:'Left+Right', 12294:'Left+Center', 12295:'All'}
},
/* */
'FlashExposureComp',
{
desc: 'AutoExposureBracketing',
val: {_:'On',0:'Off', 1:'On (shot 1)', 2:'On (shot 2)', 3:'On (shot 3)'}
},
'AEBBracketValue',
{
desc: 'ControlMode',
val: {0:'n/a', 1:'Camera Local Control', 2:'On', 3:'Computer Remote Control'}
},
'FocusDistanceUpper', 'FocusDistanceLower', 'FNumber', 'ExposureTime', 'MeasuredEV2', 'BulbDuration', null,
{
desc: 'CameraType',
val: {0:'n/a', 248:'EOS High-end', 250:'Compact', 252:'EOS Mid-range', 255:'DV Camera'}
},
{
desc: 'AutoRotate',
val: {_:'n/a',0:'none', 1:'Rotate 90 CW', 2:'Rotate 180', 3:'Rotate 270 CW'}
},
{
desc: 'NDFilter',
val: {_:'n/a',0:'Off', 1:'On'}
},
'SelfTimer', null, null, null, 'FlashOutput'
];
var pano = [
null,
null,
'PanoramaFrameNumber',
null,
null,
{desc: 'PanoramaDirection', val: {0:'Left to Right', 1:'Right to Left', 2:'Bottom to Top', 3:'Top to Bottom', 4:'2x2 Matrix (Clockwise)'}}
];
var camInfos = {
'1D': {
4: 'ExposureTime',
10: 'FocalLength',
13: { ref: 'LensType' },
14: 'MinFocalLength',
16: 'MaxFocalLength',
66: 'Sharpness',
68: { ref: 'WhiteBalance' },
72: 'ColorTemperature, Sharpness',
74: { ref: 'WhiteBalance' },
75: { ref: 'PictureStyle' },
78: 'ColorTemperature',
81: { ref: 'PictureStyle' },
/* note: duplicates are for 1DS (crazy canon) */
/*, 0 = n/a\n 1 = Lowest\n 2 = Low': '' */
},
'1DmkII': {
4: 'ExposureTime',
9: 'FocalLength',
12: { ref: 'LensType' },
17: 'MinFocalLength',
19: 'MaxFocalLength',
45: { desc: 'FocalType', val: {0:"Fixed", 2:"Zoom"} },
54: { ref: 'WhiteBalance' },
55: 'ColorTemperature',
102: 'JPEGQuality',
108: { ref: 'PictureStyle' },
110: { desc: 'Saturation', val: {0:"Normal"} },
111: { desc: 'ColorTone', val: {0:"Normal"} },
114: 'Sharpness',
115: { desc: 'Contrast', val: {0:"Normal"} },
117: 'ISO'/*,
0 = Large\n 1 = Medium\n 2 = Small\n 5 = Medium 1\n 6 = Medium 2\n 7 = Medium 3\n 8 = Postcard\n 9 = Widescreen\n 10 = Medium Widescreen': ''*/
},
'1DmkIIN': {
4: 'ExposureTime',
9: 'FocalLength',
12: { ref: 'LensType' },
17: 'MinFocalLength',
19: 'MaxFocalLength',
54: { ref: 'WhiteBalance' },
55: 'ColorTemperature',
115: { ref: 'PictureStyle' },
116: 'Sharpness',
117: { desc: 'Contrast', val: {0:"Normal"} },
118: { desc: 'Saturation', val: {0:"Normal"} },
119: { desc: 'ColorTone', val: {0:"Normal"} },
121: 'ISO'
},
'1DmkIII': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
24: 'CameraTemperature',
27: 'MacroMagnification',
29: 'FocalLength',
48: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
67: 'FocusDistanceUpper',
69: 'FocusDistanceLower',
94: { ref: 'WhiteBalance' },
98: 'ColorTemperature',
134: { ref: 'PictureStyle' },
273: { ref: 'LensType' },
275: 'MinFocalLength',
277: 'MaxFocalLength',
310: 'FirmwareVersion',
370: 'FileIndex',
374: 'ShutterCount',
382: 'DirectoryIndex',
682: { ref: 'PictureStyleInfo' },
1114: 'TimeStamp1',
1118: 'TimeStamp'
},
'1DmkIV Tags': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
7: { desc: 'HighlightTonePriority', val: {0:"Off", 1:"On"} },
8: 'MeasuredEV2',
9: 'MeasuredEV3',
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
25: 'CameraTemperature',
30: 'FocalLength',
53: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
84: 'FocusDistanceUpper',
86: 'FocusDistanceLower',
120: { ref: 'WhiteBalance' },
124: 'ColorTemperature',
335: { ref: 'LensType' },
337: 'MinFocalLength',
339: 'MaxFocalLength',
493: 'FirmwareVersion',
556: 'FileIndex',
568: 'DirectoryIndex',
872: { ref: 'PictureStyleInfo' }
},
'1DX': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
27: 'CameraTemperature',
35: 'FocalLength',
125: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
140: 'FocusDistanceUpper',
142: 'FocusDistanceLower',
188: { ref: 'WhiteBalance' },
192: 'ColorTemperature',
244: { ref: 'PictureStyle' },
423: { ref: 'LensType' },
425: 'MinFocalLength',
427: 'MaxFocalLength',
640: 'FirmwareVersion',
720: 'FileIndex',
732: 'DirectoryIndex',
1012: { ref: 'PictureStyleInfo2' },
},
'5D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
12: { ref: 'LensType' },
23: 'CameraTemperature',
27: 'MacroMagnification',
39: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
40: 'FocalLength',
84: { ref: 'WhiteBalance' },
88: 'ColorTemperature',
108: { ref: 'PictureStyle' },
147: 'MinFocalLength',
149: 'MaxFocalLength',
151: { ref: 'LensType' },
164: 'FirmwareRevision',
172: 'ShortOwnerName',
204: 'DirectoryIndex',
208: 'FileIndex',
232: 'ContrastStandard',
233: 'ContrastPortrait',
234: 'ContrastLandscape',
235: 'ContrastNeutral',
236: 'ContrastFaithful',
237: 'ContrastMonochrome',
238: 'ContrastUserDef1',
239: 'ContrastUserDef2',
240: 'ContrastUserDef3',
241: 'SharpnessStandard',
242: 'SharpnessPortrait',
243: 'SharpnessLandscape',
244: 'SharpnessNeutral',
245: 'SharpnessFaithful',
246: 'SharpnessMonochrome',
247: 'SharpnessUserDef1',
248: 'SharpnessUserDef2',
249: 'SharpnessUserDef3',
250: 'SaturationStandard',
251: 'SaturationPortrait',
252: 'SaturationLandscape',
253: 'SaturationNeutral',
254: 'SaturationFaithful',
256: 'SaturationUserDef1',
257: 'SaturationUserDef2',
258: 'SaturationUserDef3',
259: 'ColorToneStandard',
260: 'ColorTonePortrait',
261: 'ColorToneLandscape',
262: 'ColorToneNeutral',
263: 'ColorToneFaithful',
265: 'ColorToneUserDef1',
266: 'ColorToneUserDef2',
267: 'ColorToneUserDef3',
268: { ref: 'UserDef1PictureStyle' },
270: { ref: 'UserDef2PictureStyle' },
272: { ref: 'UserDef3PictureStyle' },
284: 'TimeStamp' /*,
'Bit 0 = Center\n Bit 1 = Top\n Bit 2 = Bottom\n Bit 3 = Upper-left\n Bit 4 = Upper-right\n Bit 5 = Lower-left\n Bit 6 = Lower-right\n Bit 7 = Left': '',
'-559038737 = n/a\n 0 = None\n 1 = Yellow': '',
'-559038737 = n/a\n 0 = None\n 1 = Sepia': '' */
},
'5DmkII':{
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
7: { desc: 'HighlightTonePriority', val: {0:'Off', 1:'On'} },
21: { desc: 'FlashMeteringMode', val: {0:'E-TTL', 3:'TTL', 4:'External Auto', 5:'External Manual', 6:'Off'} },
25: 'CameraTemperature',
27: 'MacroMagnification',
30: 'FocalLength',
49:
{ desc: 'CameraOrientation', val: {0:'Horizontal (normal)', 1:'Rotate 90 CW', 2:'Rotate 270 CW'} },
80: 'FocusDistanceUpper',
82: 'FocusDistanceLower',
111: { ref: 'WhiteBalance' },
115: 'ColorTemperature',
167: { ref: 'PictureStyle' },
189:
{ desc: 'HighISONoiseReduction', val: {0:'Standard', 1:'Low', 2:'Strong', 3:'Off'} },
191:
{ desc: 'AutoLightingOptimizer', val: {0:'Standard', 1:'Low', 2:'Strong', 3:'Off'} },
230: { ref: 'LensType' },
232: 'MinFocalLength',
234: 'MaxFocalLength',
382: 'FirmwareVersion',
443: 'FileIndex',
455: 'DirectoryIndex',
759: { ref: 'PictureStyleInfo' }
},
'5DmkIII': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
27: 'CameraTemperature',
35: 'FocalLength',
125: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
140: 'FocusDistanceUpper',
142: 'FocusDistanceLower',
188: { ref: 'WhiteBalance' },
192: 'ColorTemperature',
244: { ref: 'PictureStyle' },
339: { ref: 'LensType' },
341: 'MinFocalLength',
343: 'MaxFocalLength',
572: 'FirmwareVersion',
652: 'FileIndex',
656: 'FileIndex2',
664: 'DirectoryIndex',
668: 'DirectoryIndex2',
944: { ref: 'PictureStyleInfo2' }
},
'6D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
27: 'CameraTemperature',
35: 'FocalLength',
131: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
146: 'FocusDistanceUpper',
148: 'FocusDistanceLower',
194: { ref: 'WhiteBalance' },
198: 'ColorTemperature',
250: { ref: 'PictureStyle' },
353: { ref: 'LensType' },
355: 'MinFocalLength',
357: 'MaxFocalLength',
598: 'FirmwareVersion',
682: 'FileIndex',
694: 'DirectoryIndex',
966: { ref: 'PictureStyleInfo2' }
},
'7D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
7: { desc: 'HighlightTonePriority', val: {0:"Off", 1:"On"} },
8: 'MeasuredEV2',
9: 'MeasuredEV',
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
25: 'CameraTemperature',
30: 'FocalLength',
53: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
84: 'FocusDistanceUpper',
86: 'FocusDistanceLower',
119: { ref: 'WhiteBalance' },
123: 'ColorTemperature',
201: { desc: 'HighISONoiseReduction', val: {0:"Standard", 1:"Low", 2:"Strong", 3:"Off"} },
274: { ref: 'LensType' },
276: 'MinFocalLength',
278: 'MaxFocalLength',
428: 'FirmwareVersion',
491: 'FileIndex',
503: 'DirectoryIndex',
807: { ref: 'PictureStyleInfo' }
},
'40D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
24: 'CameraTemperature',
27: 'MacroMagnification',
29: 'FocalLength',
48: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
67: 'FocusDistanceUpper',
69: 'FocusDistanceLower',
111: { ref: 'WhiteBalance' },
115: 'ColorTemperature',
214: { ref: 'LensType' },
216: 'MinFocalLength',
218: 'MaxFocalLength',
255: 'FirmwareVersion',
307: 'FileIndex',
319: 'DirectoryIndex',
603: { ref: 'PictureStyleInfo' },
2347: 'LensModel'
},
'50D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
7: { desc: 'HighlightTonePriority', val: {0:"Off", 1:"On"} },
21:{ desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
25: 'CameraTemperature',
30: 'FocalLength',
49: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
80: 'FocusDistanceUpper',
82: 'FocusDistanceLower',
111: { ref: 'WhiteBalance' },
115: 'ColorTemperature',
167: { ref: 'PictureStyle' },
189: { desc: 'HighISONoiseReduction', val: {0:"Standard", 1:"Low", 2:"Strong", 3:"Off"} },
191: { desc: 'AutoLightingOptimizer', val: {0:"Standard", 1:"Low", 2:"Strong", 3:"Off"} },
234: { ref: 'LensType' },
236: 'MinFocalLength',
238: 'MaxFocalLength',
350: 'FirmwareVersion',
411: 'FileIndex',
423: 'DirectoryIndex',
727: { ref: 'PictureStyleInfo' }
},
'60D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
25: 'CameraTemperature',
30: 'FocalLength',
54: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
85: 'FocusDistanceUpper',
87: 'FocusDistanceLower',
125: 'ColorTemperature',
232: { ref: 'LensType' },
234: 'MinFocalLength',
236: 'MaxFocalLength',
409: 'FirmwareVersion',
473: 'FileIndex',
485: 'DirectoryIndex',
801: { ref: 'PictureStyleInfo2' }
},
'70D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
27: 'CameraTemperature',
35: 'FocalLength',
132: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
147: 'FocusDistanceUpper',
149: 'FocusDistanceLower',
199: 'ColorTemperature',
358: { ref: 'LensType' },
360: 'MinFocalLength',
362: 'MaxFocalLength',
606: 'FirmwareVersion',
691: 'FileIndex',
703: 'DirectoryIndex',
975: { ref: 'PictureStyleInfo2' }
},
'450D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
24: 'CameraTemperature',
27: 'MacroMagnification',
29: 'FocalLength',
48: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
67: 'FocusDistanceUpper',
69: 'FocusDistanceLower',
111: { ref: 'WhiteBalance' },
115: 'ColorTemperature',
222: { ref: 'LensType' },
263: 'FirmwareVersion',
271: 'OwnerName',
307: 'DirectoryIndex',
319: 'FileIndex',
611: { ref: 'PictureStyleInfo' },
2355: 'LensModel'
},
'500D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
7: { desc: 'HighlightTonePriority', val: {0:"Off", 1:"On"} },
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
25: 'CameraTemperature',
30: 'FocalLength',
49: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
80: 'FocusDistanceUpper',
82: 'FocusDistanceLower',
115: { ref: 'WhiteBalance' },
119: 'ColorTemperature',
171: { ref: 'PictureStyle' },
188: { desc: 'HighISONoiseReduction', val: {0:"Standard", 1:"Low", 2:"Strong", 3:"Off"} },
190: { desc: 'AutoLightingOptimizer', val: {0:"Standard", 1:"Low", 2:"Strong", 3:"Off"} },
246: { ref: 'LensType' },
248: 'MinFocalLength',
250: 'MaxFocalLength',
400: 'FirmwareVersion',
467: 'FileIndex',
479: 'DirectoryIndex',
779: { ref: 'PictureStyleInfo' }
},
'550D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
7: { desc: 'HighlightTonePriority', val: {0:"Off", 1:"On"} },
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
25: 'CameraTemperature',
30: 'FocalLength',
53: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
84: 'FocusDistanceUpper',
86: 'FocusDistanceLower',
120: { ref: 'WhiteBalance' },
124: 'ColorTemperature',
176: { ref: 'PictureStyle' },
255: { ref: 'LensType' },
257: 'MinFocalLength',
259: 'MaxFocalLength',
420: 'FirmwareVersion',
484: 'FileIndex',
496: 'DirectoryIndex',
796: { ref: 'PictureStyleInfo' }
},
'600D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
7: { desc: 'HighlightTonePriority', val: {0:"Off", 1:"On"} },
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
25: 'CameraTemperature',
30: 'FocalLength',
56: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
87: 'FocusDistanceUpper',
89: 'FocusDistanceLower',
123: { ref: 'WhiteBalance' },
127: 'ColorTemperature',
179: { ref: 'PictureStyle' },
234: { ref: 'LensType' },
236: 'MinFocalLength',
238: 'MaxFocalLength',
411: 'FirmwareVersion',
475: 'FileIndex',
487: 'DirectoryIndex',
763: { ref: 'PictureStyleInfo2' }
},
'650D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
27: 'CameraTemperature',
35: 'FocalLength',
125: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
140: 'FocusDistanceUpper',
142: 'FocusDistanceLower',
188: { ref: 'WhiteBalance' },
192: 'ColorTemperature',
244: { ref: 'PictureStyle' },
295: { ref: 'LensType' },
297: 'MinFocalLength',
299: 'MaxFocalLength',
539: 'FirmwareVersion',
544: 'FirmwareVersion',
624: 'FileIndex',
628: 'FileIndex',
636: 'DirectoryIndex',
640: 'DirectoryIndex',
912: { ref: 'PictureStyleInfo2' }
},
'1000D': {
3: 'FNumber',
4: 'ExposureTime',
6: 'ISO',
21: { desc: 'FlashMeteringMode', val: {0:"E-TTL", 3:"TTL", 4:"External Auto", 5:"External Manual", 6:"Off"} },
24: 'CameraTemperature',
27: 'MacroMagnification',
29: 'FocalLength',
48: { desc: 'CameraOrientation', val: {0:"Horizontal (normal)", 1:"Rotate 90 CW", 2:"Rotate 270 CW"} },
67: 'FocusDistanceUpper',
69: 'FocusDistanceLower',
111: { ref: 'WhiteBalance' },
115: 'ColorTemperature',
226: { ref: 'LensType' },
228: 'MinFocalLength',
230: 'MaxFocalLength',
267: 'FirmwareVersion',
311: 'DirectoryIndex',
323: 'FileIndex',
615: { ref: 'PictureStyleInfo' },
2359: 'LensModel'
},
'PowerShot': {
0: 'ISO',
5: 'FNumber',
6: 'ExposureTime',
23: 'Rotation',
135: 'CameraTemperature',
145: 'CameraTemperature'
},
'PowerShot2': {
1: 'ISO',
6: 'FNumber',
7: 'ExposureTime',
24: 'Rotation',
153: 'CameraTemperature',
159: 'CameraTemperature',
164: 'CameraTemperature',
168: 'CameraTemperature',
261: 'CameraTemperature'
},
'Unknown32': {
71: 'CameraTemperature',
83: 'CameraTemperature',
91: 'CameraTemperature',
92: 'CameraTemperature',
100: 'CameraTemperature'
}
};
var references = {
'WhiteBalance': {
0:'Auto',
1:'Daylight',
2:'Cloudy',
3:'Tungsten',
4:'Fluorescent',
5:'Flash',
6:'Custom',
7:'Black & White',
8:'Shade',
9:'Manual Temperature (Kelvin)',
10:'PC Set1',
11:'PC Set2',
12:'PC Set3',
14:'Daylight Fluorescent',
15:'Custom 1',
16:'Custom 2',
17:'Underwater',
18:'Custom 3',
19:'Custom 4',
20:'PC Set4',
21:'PC Set5'
},
'PictureStyle': {
0x0: 'None',
0x1: 'Standard',
0x2: 'Portrait',
0x3: 'High Saturation',
0x4: 'Adobe RGB',
0x5: 'Low Saturation',
0x6: 'CM Set 1',
0x7: 'CM Set 2',
0x21: 'User Def. 1',
0x22: 'User Def. 2',
0x23: 'User Def. 3',
0x41: 'PC 1',
0x42: 'PC 2',
0x43: 'PC 3',
0x81: 'Standard',
0x82: 'Portrait',
0x83: 'Landscape',
0x84: 'Neutral',
0x85: 'Faithful',
0x86: 'Monochrome',
0x87: 'Auto'
},
'LensType': {
/* TODO */
/* dec. values and >256 incorrect for EOS 7D */
},
'PictureStyleInfo': {
0: 'ContrastStandard',
4: 'SharpnessStandard',
8: 'SaturationStandard',
12: 'ColorToneStandard',
16: 'FilterEffectStandard?',
20: 'ToningEffectStandard?',
24: 'ContrastPortrait',
28: 'SharpnessPortrait',
32: 'SaturationPortrait',
36: 'ColorTonePortrait',
40: 'FilterEffectPortrait?',
44: 'ToningEffectPortrait?',
48: 'ContrastLandscape',
52: 'SharpnessLandscape',
56: 'SaturationLandscape',
60: 'ColorToneLandscape',
64: 'FilterEffectLandscape?',
68: 'ToningEffectLandscape?',
72: 'ContrastNeutral',
76: 'SharpnessNeutral',
80: 'SaturationNeutral',
84: 'ColorToneNeutral',
88: 'FilterEffectNeutral?',
92: 'ToningEffectNeutral?',
96: 'ContrastFaithful',
100: 'SharpnessFaithful',
104: 'SaturationFaithful',
108: 'ColorToneFaithful',
112: 'FilterEffectFaithful?',
116: 'ToningEffectFaithful?',
120: 'ContrastMonochrome',
124: 'SharpnessMonochrome',
128: 'SaturationMonochrome?',
132: 'ColorToneMonochrome?',
144: 'ContrastUserDef1',
148: 'SharpnessUserDef1',
152: 'SaturationUserDef1',
156: 'ColorToneUserDef1',
168: 'ContrastUserDef2',
172: 'SharpnessUserDef2',
176: 'SaturationUserDef2',
180: 'ColorToneUserDef2',
192: 'ContrastUserDef3',
196: 'SharpnessUserDef3',
200: 'SaturationUserDef3',
204: 'ColorToneUserDef3',
},
'PictureStyleInfo2': {
0: 'ContrastStandard',
4: 'SharpnessStandard',
8: 'SaturationStandard',
12: 'ColorToneStandard',
16: 'FilterEffectStandard?',
20: 'ToningEffectStandard?',
24: 'ContrastPortrait',
28: 'SharpnessPortrait',
32: 'SaturationPortrait',
36: 'ColorTonePortrait',
40: 'FilterEffectPortrait?',
44: 'ToningEffectPortrait?',
48: 'ContrastLandscape',
52: 'SharpnessLandscape',
56: 'SaturationLandscape',
60: 'ColorToneLandscape',
64: 'FilterEffectLandscape?',
68: 'ToningEffectLandscape?',
72: 'ContrastNeutral',
76: 'SharpnessNeutral',
80: 'SaturationNeutral',
84: 'ColorToneNeutral',
88: 'FilterEffectNeutral?',
92: 'ToningEffectNeutral?',
96: 'ContrastFaithful',
100: 'SharpnessFaithful',
104: 'SaturationFaithful',
108: 'ColorToneFaithful',
112: 'FilterEffectFaithful?',
116: 'ToningEffectFaithful?',
120: 'ContrastMonochrome',
124: 'SharpnessMonochrome',
128: 'SaturationMonochrome?',
132: 'ColorToneMonochrome?',
144: 'ContrastAuto',
148: 'SharpnessAuto',
152: 'SaturationAuto',
156: 'ColorToneAuto',
168: 'ContrastUserDef1',
172: 'SharpnessUserDef1',
176: 'SaturationUserDef1',
180: 'ColorToneUserDef1',
192: 'ContrastUserDef2',
196: 'SharpnessUserDef2',
200: 'SaturationUserDef2',
204: 'ColorToneUserDef2',
216: 'ContrastUserDef3',
220: 'SharpnessUserDef3',
224: 'SaturationUserDef3',
228: 'ColorToneUserDef3',
240: { ref: 'UserDef1PictureStyle' },
242: { ref: 'UserDef2PictureStyle' },
244: { ref: 'UserDef3PictureStyle' }
},
'UserDefStyle': {
0x41: 'PC 1',
0x42: 'PC 2',
0x43: 'PC 3',
0x81: 'Standard',
0x82: 'Portrait',
0x83: 'Landscape',
0x84: 'Neutral',
0x85: 'Faithful',
0x86: 'Monochrome',
0x87: 'Auto'
}
}
var map = function(m1,m2){
if(Buffer.isBuffer(makernoteData[m1])) makernoteData[m1] = makernoteData[m1].toJSON();
if(makernoteData[m1] instanceof Array && m2 instanceof Array){
var o = {};
makernoteData[m1].forEach(function(id,i) {
if(m2[i] && i<m2.length){
if(typeof m2[i] === 'string'){
o[m2[i]] = id;
} else if(typeof m2[i] === 'object' && typeof id === 'number'){
var s = ('ref' in m2[i] && m2[i].ref in references) ? references[m2[i].ref] : m2[i].val;
var _name = ( id in s ) ? s[id] : '';
if(id<0 && ( '_' in s )) _name = s['_'];
o[m2[i].desc] = (_name=='') ? id : { value:id, name:_name };
_name = null;
}
}
});
makernoteData[m1] = o;
o = null;
} else if(makernoteData[m1] instanceof Array && typeof m2 === 'object'){
var o = {};
for(var k in m2){
if(k<makernoteData[m1].length) {
if(typeof m2[k] === 'string'){
o[m2[k]] = makernoteData[m1][k];
} else if(typeof m2[k] === 'object'){
var s = ('ref' in m2[k] && m2[k].ref in references) ? references[m2[k].ref] : m2[k].val;
var id = makernoteData[m1][k];
/* val: {_:'n/a',0:'Off', 1:'Night Scene', 2:'On', 3:'None'} */
var _name = ( id in s ) ? s[id] : '';
if(id<0 && ( '_' in s )) _name = s['_'];
o[m2[k].desc] = (_name=='') ? id : { value:id, name:_name };
_name = null;
}
}
}
makernoteData[m1] = o;
o = null;
} else {
if(makernoteData[m1] in m2) makernoteData[m1] = { value:makernoteData[m1], name:m2[makernoteData[m1]] };
}
}
// data starts at 0 ...
// Get the number of entries and extract them
var numberOfEntries = data.getShort(makernoteOffset, this.isBigEndian, tiffOffset);
var makernoteEndianness = this.isBigEndian;
// according to http://search.cpan.org/~bettelli/Image-MetaData-JPEG-0.153/lib/Image/MetaData/JPEG.pod#On_the_problem_of_MakerNote_corruption_and_ways_to_overcome_it
// it seems that makernotes should only have 1-255 items. If we see more than 255,
// we probably have an endianness issue (i.e. the makernote is using a different endianness than
// the container file/exif block). This seems like an OK mediation strategy.
// endian-flipped-makernote.jpg shows a realworld file seen with this problem.
if (numberOfEntries > 255) {
makernoteEndianness = !makernoteEndianness;
numberOfEntries = data.getShort(makernoteOffset, makernoteEndianness, tiffOffset);
}
for (var i = 0; i < numberOfEntries; i++) {
var exifEntry = this.extractExifEntry(data, (makernoteOffset + 2 + (i * 12)), tiffOffset, makernoteEndianness, tags);
if (exifEntry && exifEntry.tagName !== null){
if(typeof exifEntry.value === 'string'){
makernoteData[exifEntry.tagName] = exifEntry.value.replace(/\0/g,'').trim();
} else {
makernoteData[exifEntry.tagName] = exifEntry.value;
}
}
}
map('CameraSettings', camSettings);
map('FocalLength', focal);
map('ShotInfo', shotInfo);
map('Panorama', pano);
map('ModelID', cameras);
if('ModelID' in makernoteData && 'name' in makernoteData.ModelID){
var tName = exports.identifyCanonCameraInfo(makernoteData.ModelID.name, makernoteData.CameraInfo);
var table = (tName in camInfos) ? camInfos[tName] : camInfos['UNKNOWN'];
map('CameraInfo', table);
} else {
makernoteData.CameraInfo = {};
}
if('DustRemovalData' in makernoteData && Buffer.isBuffer(makernoteData.DustRemovalData)){
makernoteData.DustRemovalData = makernoteData.DustRemovalData.toJSON();
}
//console.log(util.inspect(makernoteData, false, null));
/*
console.log( 'CameraSettings', makernoteData.CameraSettings );
console.log( 'FocalLength', makernoteData.FocalLength );
console.log( 'ShotInfo', makernoteData.ShotInfo );
console.log( 'Panorama', makernoteData.Panorama );
console.log( 'ModelID', makernoteData.ModelID );
console.log( 'CameraInfo', makernoteData.CameraInfo );
*/
return makernoteData;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment