Nikon.pm 247 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758
  1. #------------------------------------------------------------------------------
  2. # File: Nikon.pm
  3. #
  4. # Description: Nikon EXIF maker notes tags
  5. #
  6. # Revisions: 12/09/2003 - P. Harvey Created
  7. # 05/17/2004 - P. Harvey Added information from Joseph Heled
  8. # 09/21/2004 - P. Harvey Changed tag 2 to ISOUsed & added PrintConv
  9. # 12/01/2004 - P. Harvey Added default PRINT_CONV
  10. # 01/01/2005 - P. Harvey Decode preview image and preview IFD
  11. # 03/35/2005 - T. Christiansen additions
  12. # 05/10/2005 - P. Harvey Decode encrypted lens data
  13. # [ongoing] - P. Harvey Constantly decoding new information
  14. #
  15. # References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
  16. # 2) Joseph Heled private communication (tests with D70)
  17. # 3) Thomas Walter private communication (tests with Coolpix 5400)
  18. # 4) http://www.cybercom.net/~dcoffin/dcraw/
  19. # 5) Brian Ristuccia private communication (tests with D70)
  20. # 6) Danek Duvall private communication (tests with D70)
  21. # 7) Tom Christiansen private communication (tests with D70)
  22. # 8) Robert Rottmerhusen private communication
  23. # 9) http://members.aol.com/khancock/pilot/nbuddy/
  24. # 10) Werner Kober private communication (D2H, D2X, D100, D70, D200, D90)
  25. # 11) http://www.rottmerhusen.com/objektives/lensid/thirdparty.html
  26. # 12) http://libexif.sourceforge.net/internals/mnote-olympus-tag_8h-source.html
  27. # 13) Roger Larsson private communication (tests with D200)
  28. # 14) http://homepage3.nifty.com/kamisaka/makernote/makernote_nikon.htm (2007/09/15)
  29. # 15) http://tomtia.plala.jp/DigitalCamera/MakerNote/index.asp
  30. # 16) Jeffrey Friedl private communication (D200 with firmware update)
  31. # 17) http://www.wohlberg.net/public/software/photo/nstiffexif/
  32. # and Brendt Wohlberg private communication
  33. # 18) Anonymous user private communication (D70, D200, D2x)
  34. # 19) Bruce Stevens private communication
  35. # 20) Vladimir Sauta private communication (D80)
  36. # 21) Gregor Dorlars private communication (D300)
  37. # 22) Tanel Kuusk private communication
  38. # 23) Alexandre Naaman private communication (D3)
  39. # 24) Geert De Soete private communication
  40. # 25) Niels Kristian Bech Jensen private communication
  41. # 26) Bozi (http://www.cpanforum.com/posts/8983)
  42. # 27) Jens Kriese private communication
  43. # 28) Warren Hatch private communication (D3v2.00 with SB-800 and SB-900)
  44. # 29) Anonymous contribution 2011/05/25 (D700, D7000)
  45. # 30) http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3833.30.html
  46. # 31) Michael Relt private communication
  47. # 32) Stefan http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4494.0.html
  48. # 33) Iliah Borg private communication (LibRaw)
  49. # 34) Stewart Bennett private communication (D4S, D810)
  50. # 35) David Puschel private communication
  51. # JD) Jens Duttke private communication
  52. #------------------------------------------------------------------------------
  53. package Image::ExifTool::Nikon;
  54. use strict;
  55. use vars qw($VERSION %nikonLensIDs %nikonTextEncoding);
  56. use Image::ExifTool qw(:DataAccess :Utils);
  57. use Image::ExifTool::Exif;
  58. $VERSION = '3.14';
  59. sub LensIDConv($$$);
  60. sub ProcessNikonAVI($$$);
  61. sub ProcessNikonMOV($$$);
  62. sub FormatString($);
  63. sub ProcessNikonCaptureEditVersions($$$);
  64. sub PrintAFPoints($$);
  65. sub PrintAFPointsInv($$$);
  66. sub PrintAFPointsGrid($$);
  67. sub PrintAFPointsGridInv($$$);
  68. sub GetAFPointGrid($$;$);
  69. # nikon lens ID numbers (ref 8/11)
  70. %nikonLensIDs = (
  71. Notes => q{
  72. The Nikon LensID is constructed as a Composite tag from the raw hex values
  73. of 8 other tags: LensIDNumber, LensFStops, MinFocalLength, MaxFocalLength,
  74. MaxApertureAtMinFocal, MaxApertureAtMaxFocal, MCUVersion and LensType, in
  75. that order. (source:
  76. L<http://www.rottmerhusen.com/objektives/lensid/thirdparty.html>.) Multiple
  77. lenses with the same LensID are differentiated by decimal values in the list
  78. below. The user-defined "Lenses" list may be used to specify the lens for
  79. ExifTool to choose in these cases (see the
  80. L<sample config file|../config.html> for details).
  81. },
  82. OTHER => \&LensIDConv,
  83. # Note: Sync this list with Robert's Perl version at
  84. # http://www.rottmerhusen.com/objektives/lensid/files/exif/fmountlens.p.txt
  85. # (hex digits must be uppercase in keys below)
  86. '01 58 50 50 14 14 02 00' => 'AF Nikkor 50mm f/1.8',
  87. '01 58 50 50 14 14 05 00' => 'AF Nikkor 50mm f/1.8',
  88. '02 42 44 5C 2A 34 02 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5',
  89. '02 42 44 5C 2A 34 08 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5',
  90. '03 48 5C 81 30 30 02 00' => 'AF Zoom-Nikkor 70-210mm f/4',
  91. '04 48 3C 3C 24 24 03 00' => 'AF Nikkor 28mm f/2.8',
  92. '05 54 50 50 0C 0C 04 00' => 'AF Nikkor 50mm f/1.4',
  93. '06 54 53 53 24 24 06 00' => 'AF Micro-Nikkor 55mm f/2.8',
  94. '07 40 3C 62 2C 34 03 00' => 'AF Zoom-Nikkor 28-85mm f/3.5-4.5',
  95. '08 40 44 6A 2C 34 04 00' => 'AF Zoom-Nikkor 35-105mm f/3.5-4.5',
  96. '09 48 37 37 24 24 04 00' => 'AF Nikkor 24mm f/2.8',
  97. '0A 48 8E 8E 24 24 03 00' => 'AF Nikkor 300mm f/2.8 IF-ED',
  98. '0A 48 8E 8E 24 24 05 00' => 'AF Nikkor 300mm f/2.8 IF-ED N',
  99. '0B 48 7C 7C 24 24 05 00' => 'AF Nikkor 180mm f/2.8 IF-ED',
  100. '0D 40 44 72 2C 34 07 00' => 'AF Zoom-Nikkor 35-135mm f/3.5-4.5',
  101. '0E 48 5C 81 30 30 05 00' => 'AF Zoom-Nikkor 70-210mm f/4',
  102. '0F 58 50 50 14 14 05 00' => 'AF Nikkor 50mm f/1.8 N',
  103. '10 48 8E 8E 30 30 08 00' => 'AF Nikkor 300mm f/4 IF-ED',
  104. '11 48 44 5C 24 24 08 00' => 'AF Zoom-Nikkor 35-70mm f/2.8',
  105. '12 48 5C 81 30 3C 09 00' => 'AF Nikkor 70-210mm f/4-5.6',
  106. '13 42 37 50 2A 34 0B 00' => 'AF Zoom-Nikkor 24-50mm f/3.3-4.5',
  107. '14 48 60 80 24 24 0B 00' => 'AF Zoom-Nikkor 80-200mm f/2.8 ED',
  108. '15 4C 62 62 14 14 0C 00' => 'AF Nikkor 85mm f/1.8',
  109. '17 3C A0 A0 30 30 0F 00' => 'Nikkor 500mm f/4 P ED IF',
  110. '17 3C A0 A0 30 30 11 00' => 'Nikkor 500mm f/4 P ED IF',
  111. '18 40 44 72 2C 34 0E 00' => 'AF Zoom-Nikkor 35-135mm f/3.5-4.5 N',
  112. '1A 54 44 44 18 18 11 00' => 'AF Nikkor 35mm f/2',
  113. '1B 44 5E 8E 34 3C 10 00' => 'AF Zoom-Nikkor 75-300mm f/4.5-5.6',
  114. '1C 48 30 30 24 24 12 00' => 'AF Nikkor 20mm f/2.8',
  115. '1D 42 44 5C 2A 34 12 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5 N',
  116. '1E 54 56 56 24 24 13 00' => 'AF Micro-Nikkor 60mm f/2.8',
  117. '1F 54 6A 6A 24 24 14 00' => 'AF Micro-Nikkor 105mm f/2.8',
  118. '20 48 60 80 24 24 15 00' => 'AF Zoom-Nikkor 80-200mm f/2.8 ED',
  119. '21 40 3C 5C 2C 34 16 00' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5',
  120. '22 48 72 72 18 18 16 00' => 'AF DC-Nikkor 135mm f/2',
  121. '23 30 BE CA 3C 48 17 00' => 'Zoom-Nikkor 1200-1700mm f/5.6-8 P ED IF',
  122. '24 48 60 80 24 24 1A 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
  123. '25 48 44 5C 24 24 1B 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
  124. '25 48 44 5C 24 24 3A 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
  125. '25 48 44 5C 24 24 52 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
  126. '26 40 3C 5C 2C 34 1C 02' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5D',
  127. '27 48 8E 8E 24 24 1D 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED',
  128. '27 48 8E 8E 24 24 F1 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED + TC-14E',
  129. '27 48 8E 8E 24 24 E1 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED + TC-17E',
  130. '27 48 8E 8E 24 24 F2 02' => 'AF-I Nikkor 300mm f/2.8D IF-ED + TC-20E',
  131. '28 3C A6 A6 30 30 1D 02' => 'AF-I Nikkor 600mm f/4D IF-ED',
  132. '28 3C A6 A6 30 30 F1 02' => 'AF-I Nikkor 600mm f/4D IF-ED + TC-14E',
  133. '28 3C A6 A6 30 30 E1 02' => 'AF-I Nikkor 600mm f/4D IF-ED + TC-17E',
  134. '28 3C A6 A6 30 30 F2 02' => 'AF-I Nikkor 600mm f/4D IF-ED + TC-20E',
  135. '2A 54 3C 3C 0C 0C 26 02' => 'AF Nikkor 28mm f/1.4D',
  136. '2B 3C 44 60 30 3C 1F 02' => 'AF Zoom-Nikkor 35-80mm f/4-5.6D',
  137. '2C 48 6A 6A 18 18 27 02' => 'AF DC-Nikkor 105mm f/2D',
  138. '2D 48 80 80 30 30 21 02' => 'AF Micro-Nikkor 200mm f/4D IF-ED',
  139. '2E 48 5C 82 30 3C 22 02' => 'AF Nikkor 70-210mm f/4-5.6D',
  140. '2E 48 5C 82 30 3C 28 02' => 'AF Nikkor 70-210mm f/4-5.6D',
  141. '2F 48 30 44 24 24 29 02.1' => 'AF Zoom-Nikkor 20-35mm f/2.8D IF',
  142. '30 48 98 98 24 24 24 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED',
  143. '30 48 98 98 24 24 F1 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED + TC-14E',
  144. '30 48 98 98 24 24 E1 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED + TC-17E',
  145. '30 48 98 98 24 24 F2 02' => 'AF-I Nikkor 400mm f/2.8D IF-ED + TC-20E',
  146. '31 54 56 56 24 24 25 02' => 'AF Micro-Nikkor 60mm f/2.8D',
  147. '32 54 6A 6A 24 24 35 02.1' => 'AF Micro-Nikkor 105mm f/2.8D',
  148. '33 48 2D 2D 24 24 31 02' => 'AF Nikkor 18mm f/2.8D',
  149. '34 48 29 29 24 24 32 02' => 'AF Fisheye Nikkor 16mm f/2.8D',
  150. '35 3C A0 A0 30 30 33 02' => 'AF-I Nikkor 500mm f/4D IF-ED',
  151. '35 3C A0 A0 30 30 F1 02' => 'AF-I Nikkor 500mm f/4D IF-ED + TC-14E',
  152. '35 3C A0 A0 30 30 E1 02' => 'AF-I Nikkor 500mm f/4D IF-ED + TC-17E',
  153. '35 3C A0 A0 30 30 F2 02' => 'AF-I Nikkor 500mm f/4D IF-ED + TC-20E',
  154. '36 48 37 37 24 24 34 02' => 'AF Nikkor 24mm f/2.8D',
  155. '37 48 30 30 24 24 36 02' => 'AF Nikkor 20mm f/2.8D',
  156. '38 4C 62 62 14 14 37 02' => 'AF Nikkor 85mm f/1.8D',
  157. '3A 40 3C 5C 2C 34 39 02' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5D',
  158. '3B 48 44 5C 24 24 3A 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D N',
  159. '3C 48 60 80 24 24 3B 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED', #25
  160. '3D 3C 44 60 30 3C 3E 02' => 'AF Zoom-Nikkor 35-80mm f/4-5.6D',
  161. '3E 48 3C 3C 24 24 3D 02' => 'AF Nikkor 28mm f/2.8D',
  162. '3F 40 44 6A 2C 34 45 02' => 'AF Zoom-Nikkor 35-105mm f/3.5-4.5D',
  163. '41 48 7C 7C 24 24 43 02' => 'AF Nikkor 180mm f/2.8D IF-ED',
  164. '42 54 44 44 18 18 44 02' => 'AF Nikkor 35mm f/2D',
  165. '43 54 50 50 0C 0C 46 02' => 'AF Nikkor 50mm f/1.4D',
  166. '44 44 60 80 34 3C 47 02' => 'AF Zoom-Nikkor 80-200mm f/4.5-5.6D',
  167. '45 40 3C 60 2C 3C 48 02' => 'AF Zoom-Nikkor 28-80mm f/3.5-5.6D',
  168. '46 3C 44 60 30 3C 49 02' => 'AF Zoom-Nikkor 35-80mm f/4-5.6D N',
  169. '47 42 37 50 2A 34 4A 02' => 'AF Zoom-Nikkor 24-50mm f/3.3-4.5D',
  170. '48 48 8E 8E 24 24 4B 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED',
  171. '48 48 8E 8E 24 24 F1 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED + TC-14E',
  172. '48 48 8E 8E 24 24 E1 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED + TC-17E',
  173. '48 48 8E 8E 24 24 F2 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED + TC-20E',
  174. '49 3C A6 A6 30 30 4C 02' => 'AF-S Nikkor 600mm f/4D IF-ED',
  175. '49 3C A6 A6 30 30 F1 02' => 'AF-S Nikkor 600mm f/4D IF-ED + TC-14E',
  176. '49 3C A6 A6 30 30 E1 02' => 'AF-S Nikkor 600mm f/4D IF-ED + TC-17E',
  177. '49 3C A6 A6 30 30 F2 02' => 'AF-S Nikkor 600mm f/4D IF-ED + TC-20E',
  178. '4A 54 62 62 0C 0C 4D 02' => 'AF Nikkor 85mm f/1.4D IF',
  179. '4B 3C A0 A0 30 30 4E 02' => 'AF-S Nikkor 500mm f/4D IF-ED',
  180. '4B 3C A0 A0 30 30 F1 02' => 'AF-S Nikkor 500mm f/4D IF-ED + TC-14E',
  181. '4B 3C A0 A0 30 30 E1 02' => 'AF-S Nikkor 500mm f/4D IF-ED + TC-17E',
  182. '4B 3C A0 A0 30 30 F2 02' => 'AF-S Nikkor 500mm f/4D IF-ED + TC-20E',
  183. '4C 40 37 6E 2C 3C 4F 02' => 'AF Zoom-Nikkor 24-120mm f/3.5-5.6D IF',
  184. '4D 40 3C 80 2C 3C 62 02' => 'AF Zoom-Nikkor 28-200mm f/3.5-5.6D IF',
  185. '4E 48 72 72 18 18 51 02' => 'AF DC-Nikkor 135mm f/2D',
  186. '4F 40 37 5C 2C 3C 53 06' => 'IX-Nikkor 24-70mm f/3.5-5.6',
  187. '50 48 56 7C 30 3C 54 06' => 'IX-Nikkor 60-180mm f/4-5.6',
  188. '52 54 44 44 18 18 00 00' => 'Zeiss Milvus 35mm f/2', #33
  189. '53 48 60 80 24 24 57 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
  190. '53 48 60 80 24 24 60 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
  191. '54 44 5C 7C 34 3C 58 02' => 'AF Zoom-Micro Nikkor 70-180mm f/4.5-5.6D ED',
  192. '54 44 5C 7C 34 3C 61 02' => 'AF Zoom-Micro Nikkor 70-180mm f/4.5-5.6D ED',
  193. '54 54 50 50 18 18 00 00' => 'Zeiss Milvus 50mm f/2 Makro', #33
  194. '56 48 5C 8E 30 3C 5A 02' => 'AF Zoom-Nikkor 70-300mm f/4-5.6D ED',
  195. '56 54 68 68 18 18 00 00' => 'Zeiss Milvus 100mm f/2 Makro', #33
  196. '59 48 98 98 24 24 5D 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED',
  197. '59 48 98 98 24 24 F1 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED + TC-14E',
  198. '59 48 98 98 24 24 E1 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED + TC-17E',
  199. '59 48 98 98 24 24 F2 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED + TC-20E',
  200. '5A 3C 3E 56 30 3C 5E 06' => 'IX-Nikkor 30-60mm f/4-5.6',
  201. '5B 44 56 7C 34 3C 5F 06' => 'IX-Nikkor 60-180mm f/4.5-5.6',
  202. '5D 48 3C 5C 24 24 63 02' => 'AF-S Zoom-Nikkor 28-70mm f/2.8D IF-ED',
  203. '5E 48 60 80 24 24 64 02' => 'AF-S Zoom-Nikkor 80-200mm f/2.8D IF-ED',
  204. '5F 40 3C 6A 2C 34 65 02' => 'AF Zoom-Nikkor 28-105mm f/3.5-4.5D IF',
  205. '60 40 3C 60 2C 3C 66 02' => 'AF Zoom-Nikkor 28-80mm f/3.5-5.6D', #(http://www.exif.org/forum/topic.asp?TOPIC_ID=16)
  206. '61 44 5E 86 34 3C 67 02' => 'AF Zoom-Nikkor 75-240mm f/4.5-5.6D',
  207. '63 48 2B 44 24 24 68 02' => 'AF-S Nikkor 17-35mm f/2.8D IF-ED',
  208. '64 00 62 62 24 24 6A 02' => 'PC Micro-Nikkor 85mm f/2.8D',
  209. '65 44 60 98 34 3C 6B 0A' => 'AF VR Zoom-Nikkor 80-400mm f/4.5-5.6D ED',
  210. '66 40 2D 44 2C 34 6C 02' => 'AF Zoom-Nikkor 18-35mm f/3.5-4.5D IF-ED',
  211. '67 48 37 62 24 30 6D 02' => 'AF Zoom-Nikkor 24-85mm f/2.8-4D IF',
  212. '68 42 3C 60 2A 3C 6E 06' => 'AF Zoom-Nikkor 28-80mm f/3.3-5.6G',
  213. '69 48 5C 8E 30 3C 6F 06' => 'AF Zoom-Nikkor 70-300mm f/4-5.6G',
  214. '6A 48 8E 8E 30 30 70 02' => 'AF-S Nikkor 300mm f/4D IF-ED',
  215. '6B 48 24 24 24 24 71 02' => 'AF Nikkor ED 14mm f/2.8D',
  216. '6D 48 8E 8E 24 24 73 02' => 'AF-S Nikkor 300mm f/2.8D IF-ED II',
  217. '6E 48 98 98 24 24 74 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED II',
  218. '6F 3C A0 A0 30 30 75 02' => 'AF-S Nikkor 500mm f/4D IF-ED II',
  219. '70 3C A6 A6 30 30 76 02' => 'AF-S Nikkor 600mm f/4D IF-ED II',
  220. '72 48 4C 4C 24 24 77 00' => 'Nikkor 45mm f/2.8 P',
  221. '74 40 37 62 2C 34 78 06' => 'AF-S Zoom-Nikkor 24-85mm f/3.5-4.5G IF-ED',
  222. '75 40 3C 68 2C 3C 79 06' => 'AF Zoom-Nikkor 28-100mm f/3.5-5.6G',
  223. '76 58 50 50 14 14 7A 02' => 'AF Nikkor 50mm f/1.8D',
  224. '77 48 5C 80 24 24 7B 0E' => 'AF-S VR Zoom-Nikkor 70-200mm f/2.8G IF-ED',
  225. '78 40 37 6E 2C 3C 7C 0E' => 'AF-S VR Zoom-Nikkor 24-120mm f/3.5-5.6G IF-ED',
  226. '79 40 3C 80 2C 3C 7F 06' => 'AF Zoom-Nikkor 28-200mm f/3.5-5.6G IF-ED',
  227. '7A 3C 1F 37 30 30 7E 06.1' => 'AF-S DX Zoom-Nikkor 12-24mm f/4G IF-ED',
  228. '7B 48 80 98 30 30 80 0E' => 'AF-S VR Zoom-Nikkor 200-400mm f/4G IF-ED',
  229. '7D 48 2B 53 24 24 82 06' => 'AF-S DX Zoom-Nikkor 17-55mm f/2.8G IF-ED',
  230. '7F 40 2D 5C 2C 34 84 06' => 'AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED',
  231. '80 48 1A 1A 24 24 85 06' => 'AF DX Fisheye-Nikkor 10.5mm f/2.8G ED',
  232. '81 54 80 80 18 18 86 0E' => 'AF-S VR Nikkor 200mm f/2G IF-ED',
  233. '82 48 8E 8E 24 24 87 0E' => 'AF-S VR Nikkor 300mm f/2.8G IF-ED',
  234. '83 00 B0 B0 5A 5A 88 04' => 'FSA-L2, EDG 65, 800mm F13 G',
  235. '89 3C 53 80 30 3C 8B 06' => 'AF-S DX Zoom-Nikkor 55-200mm f/4-5.6G ED',
  236. '8A 54 6A 6A 24 24 8C 0E' => 'AF-S VR Micro-Nikkor 105mm f/2.8G IF-ED', #10
  237. # when the TC-20 III 2x teleconverter is used with the above lens, the following have been observed:
  238. # 8A 4D 6A 6A 24 24 8C 0E
  239. # 8A 4E 6A 6A 24 24 8C 0E
  240. # 8A 50 6A 6A 24 24 8C 0E
  241. # 8A 51 6A 6A 24 24 8C 0E
  242. # 8A 52 6A 6A 24 24 8C 0E
  243. # 8A 53 6A 6A 24 24 8C 0E
  244. # 8A 54 6A 6A 24 24 8C 0E (same as without the TC)
  245. '8B 40 2D 80 2C 3C 8D 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED',
  246. '8B 40 2D 80 2C 3C FD 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED [II]', #20
  247. '8C 40 2D 53 2C 3C 8E 06' => 'AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G ED',
  248. '8D 44 5C 8E 34 3C 8F 0E' => 'AF-S VR Zoom-Nikkor 70-300mm f/4.5-5.6G IF-ED', #10
  249. '8F 40 2D 72 2C 3C 91 06' => 'AF-S DX Zoom-Nikkor 18-135mm f/3.5-5.6G IF-ED',
  250. '90 3B 53 80 30 3C 92 0E' => 'AF-S DX VR Zoom-Nikkor 55-200mm f/4-5.6G IF-ED',
  251. '92 48 24 37 24 24 94 06' => 'AF-S Zoom-Nikkor 14-24mm f/2.8G ED',
  252. '93 48 37 5C 24 24 95 06' => 'AF-S Zoom-Nikkor 24-70mm f/2.8G ED',
  253. '94 40 2D 53 2C 3C 96 06' => 'AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G ED II', #10 (D40)
  254. '95 4C 37 37 2C 2C 97 02' => 'PC-E Nikkor 24mm f/3.5D ED',
  255. '95 00 37 37 2C 2C 97 06' => 'PC-E Nikkor 24mm f/3.5D ED', #JD
  256. '96 48 98 98 24 24 98 0E' => 'AF-S VR Nikkor 400mm f/2.8G ED',
  257. '97 3C A0 A0 30 30 99 0E' => 'AF-S VR Nikkor 500mm f/4G ED',
  258. '98 3C A6 A6 30 30 9A 0E' => 'AF-S VR Nikkor 600mm f/4G ED',
  259. '99 40 29 62 2C 3C 9B 0E' => 'AF-S DX VR Zoom-Nikkor 16-85mm f/3.5-5.6G ED',
  260. '9A 40 2D 53 2C 3C 9C 0E' => 'AF-S DX VR Zoom-Nikkor 18-55mm f/3.5-5.6G',
  261. '9B 54 4C 4C 24 24 9D 02' => 'PC-E Micro Nikkor 45mm f/2.8D ED',
  262. '9B 00 4C 4C 24 24 9D 06' => 'PC-E Micro Nikkor 45mm f/2.8D ED',
  263. '9C 54 56 56 24 24 9E 06' => 'AF-S Micro Nikkor 60mm f/2.8G ED',
  264. '9D 54 62 62 24 24 9F 02' => 'PC-E Micro Nikkor 85mm f/2.8D',
  265. '9D 00 62 62 24 24 9F 06' => 'PC-E Micro Nikkor 85mm f/2.8D',
  266. '9E 40 2D 6A 2C 3C A0 0E' => 'AF-S DX VR Zoom-Nikkor 18-105mm f/3.5-5.6G ED', #PH/10
  267. '9F 58 44 44 14 14 A1 06' => 'AF-S DX Nikkor 35mm f/1.8G', #27
  268. 'A0 54 50 50 0C 0C A2 06' => 'AF-S Nikkor 50mm f/1.4G',
  269. 'A1 40 18 37 2C 34 A3 06' => 'AF-S DX Nikkor 10-24mm f/3.5-4.5G ED',
  270. 'A2 48 5C 80 24 24 A4 0E' => 'AF-S Nikkor 70-200mm f/2.8G ED VR II',
  271. 'A3 3C 29 44 30 30 A5 0E' => 'AF-S Nikkor 16-35mm f/4G ED VR',
  272. 'A4 54 37 37 0C 0C A6 06' => 'AF-S Nikkor 24mm f/1.4G ED',
  273. 'A5 40 3C 8E 2C 3C A7 0E' => 'AF-S Nikkor 28-300mm f/3.5-5.6G ED VR',
  274. 'A6 48 8E 8E 24 24 A8 0E' => 'AF-S VR Nikkor 300mm f/2.8G IF-ED II',
  275. 'A7 4B 62 62 2C 2C A9 0E' => 'AF-S DX Micro Nikkor 85mm f/3.5G ED VR',
  276. 'A8 48 80 98 30 30 AA 0E' => 'AF-S VR Zoom-Nikkor 200-400mm f/4G IF-ED II', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3218.msg15495.html#msg15495
  277. 'A9 54 80 80 18 18 AB 0E' => 'AF-S Nikkor 200mm f/2G ED VR II',
  278. 'AA 3C 37 6E 30 30 AC 0E' => 'AF-S Nikkor 24-120mm f/4G ED VR',
  279. 'AC 38 53 8E 34 3C AE 0E' => 'AF-S DX VR Nikkor 55-300mm f/4.5-5.6G ED',
  280. 'AD 3C 2D 8E 2C 3C AF 0E' => 'AF-S DX Nikkor 18-300mm f/3.5-5.6G ED VR',
  281. 'AE 54 62 62 0C 0C B0 06' => 'AF-S Nikkor 85mm f/1.4G',
  282. 'AF 54 44 44 0C 0C B1 06' => 'AF-S Nikkor 35mm f/1.4G',
  283. 'B0 4C 50 50 14 14 B2 06' => 'AF-S Nikkor 50mm f/1.8G',
  284. 'B1 48 48 48 24 24 B3 06' => 'AF-S DX Micro Nikkor 40mm f/2.8G', #27
  285. 'B2 48 5C 80 30 30 B4 0E' => 'AF-S Nikkor 70-200mm f/4G ED VR', #35
  286. 'B3 4C 62 62 14 14 B5 06' => 'AF-S Nikkor 85mm f/1.8G',
  287. 'B4 40 37 62 2C 34 B6 0E' => 'AF-S VR Zoom-Nikkor 24-85mm f/3.5-4.5G IF-ED', #30
  288. 'B5 4C 3C 3C 14 14 B7 06' => 'AF-S Nikkor 28mm f/1.8G', #30
  289. 'B7 44 60 98 34 3C B9 0E' => 'AF-S Nikkor 80-400mm f/4.5-5.6G ED VR',
  290. 'B8 40 2D 44 2C 34 BA 06' => 'AF-S Nikkor 18-35mm f/3.5-4.5G ED',
  291. 'A0 40 2D 74 2C 3C BB 0E' => 'AF-S DX Nikkor 18-140mm f/3.5-5.6G ED VR', #PH
  292. 'A1 54 55 55 0C 0C BC 06' => 'AF-S Nikkor 58mm f/1.4G', #33
  293. 'A2 40 2D 53 2C 3C BD 0E' => 'AF-S DX VR Nikkor 18-55mm f/3.5-5.6G II',
  294. 'A4 40 2D 8E 2C 40 BF 0E' => 'AF-S DX Nikkor 18-300mm f/3.5-6.3G ED VR',
  295. 'A5 4C 44 44 14 14 C0 06' => 'AF-S Nikkor 35mm f/1.8G', #35
  296. 'A7 3C 53 80 30 3C C2 0E' => 'AF-S DX Nikkor 55-200mm f/4-5.6G ED VR II', #33
  297. 'A8 48 8E 8E 30 30 C3 4E' => 'AF-S Nikkor 300mm f/4E PF ED VR', #35
  298. 'A8 48 8E 8E 30 30 C3 0E' => 'AF-S Nikkor 300mm f/4E PF ED VR', #30
  299. 'A9 4C 31 31 14 14 C4 06' => 'AF-S Nikkor 20mm f/1.8G ED', #30
  300. 'AA 48 37 5C 24 24 C5 4E' => 'AF-S Nikkor 24-70mm f/2.8E ED VR',
  301. 'AC 3C A6 A6 30 30 C7 4E' => 'AF-S Nikkor 600mm f/4E FL ED VR', #PH
  302. 'AD 48 28 60 24 30 C8 4E' => 'AF-S VR DX 16-80mm f/2.8-4.0E ED',
  303. 'AE 3C 80 A0 3C 3C C9 4E' => 'AF-S Nikkor 200-500mm f/5.6E ED VR', #PH
  304. 'AE 3C 80 A0 3C 3C C9 0E' => 'AF-S Nikkor 200-500mm f/5.6E ED VR',
  305. 'AF 4C 37 37 14 14 CC 06' => 'AF-S Nikkor 24mm f/1.8G ED', #33
  306. '01 00 00 00 00 00 02 00' => 'TC-16A',
  307. '01 00 00 00 00 00 08 00' => 'TC-16A',
  308. '00 00 00 00 00 00 F1 0C' => 'TC-14E [II] or Sigma APO Tele Converter 1.4x EX DG or Kenko Teleplus PRO 300 DG 1.4x',
  309. '00 00 00 00 00 00 F2 18' => 'TC-20E [II] or Sigma APO Tele Converter 2x EX DG or Kenko Teleplus PRO 300 DG 2.0x',
  310. '00 00 00 00 00 00 E1 12' => 'TC-17E II',
  311. 'FE 47 00 00 24 24 4B 06' => 'Sigma 4.5mm F2.8 EX DC HSM Circular Fisheye', #JD
  312. '26 48 11 11 30 30 1C 02' => 'Sigma 8mm F4 EX Circular Fisheye',
  313. '79 40 11 11 2C 2C 1C 06' => 'Sigma 8mm F3.5 EX Circular Fisheye', #JD
  314. 'DC 48 19 19 24 24 4B 06' => 'Sigma 10mm F2.8 EX DC HSM Fisheye',
  315. '02 3F 24 24 2C 2C 02 00' => 'Sigma 14mm F3.5',
  316. '48 48 24 24 24 24 4B 02' => 'Sigma 14mm F2.8 EX Aspherical HSM',
  317. '26 48 27 27 24 24 1C 02' => 'Sigma 15mm F2.8 EX Diagonal Fisheye',
  318. 'EA 48 27 27 24 24 1C 02' => 'Sigma 15mm F2.8 EX Diagonal Fisheye', #30
  319. '26 58 31 31 14 14 1C 02' => 'Sigma 20mm F1.8 EX DG Aspherical RF',
  320. '26 58 37 37 14 14 1C 02' => 'Sigma 24mm F1.8 EX DG Aspherical Macro',
  321. 'E1 58 37 37 14 14 1C 02' => 'Sigma 24mm F1.8 EX DG Aspherical Macro',
  322. '02 46 37 37 25 25 02 00' => 'Sigma 24mm F2.8 Super Wide II Macro',
  323. '26 58 3C 3C 14 14 1C 02' => 'Sigma 28mm F1.8 EX DG Aspherical Macro',
  324. '48 54 3E 3E 0C 0C 4B 06' => 'Sigma 30mm F1.4 EX DC HSM',
  325. 'F8 54 3E 3E 0C 0C 4B 06' => 'Sigma 30mm F1.4 EX DC HSM', #JD
  326. '91 54 44 44 0C 0C 4B 06' => 'Sigma 35mm F1.4 DG HSM', #30
  327. 'DE 54 50 50 0C 0C 4B 06' => 'Sigma 50mm F1.4 EX DG HSM',
  328. '88 54 50 50 0C 0C 4B 06' => 'Sigma 50mm F1.4 DG HSM | A',
  329. '02 48 50 50 24 24 02 00' => 'Sigma Macro 50mm F2.8', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4027.0.html
  330. '32 54 50 50 24 24 35 02' => 'Sigma Macro 50mm F2.8 EX DG',
  331. 'E3 54 50 50 24 24 35 02' => 'Sigma Macro 50mm F2.8 EX DG', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3215.0.html
  332. '79 48 5C 5C 24 24 1C 06' => 'Sigma Macro 70mm F2.8 EX DG', #JD
  333. '9B 54 62 62 0C 0C 4B 06' => 'Sigma 85mm F1.4 EX DG HSM',
  334. '02 48 65 65 24 24 02 00' => 'Sigma Macro 90mm F2.8',
  335. '32 54 6A 6A 24 24 35 02.2' => 'Sigma Macro 105mm F2.8 EX DG', #JD
  336. 'E5 54 6A 6A 24 24 35 02' => 'Sigma Macro 105mm F2.8 EX DG',
  337. '97 48 6A 6A 24 24 4B 0E' => 'Sigma Macro 105mm F2.8 EX DG OS HSM',
  338. '48 48 76 76 24 24 4B 06' => 'Sigma APO Macro 150mm F2.8 EX DG HSM',
  339. 'F5 48 76 76 24 24 4B 06' => 'Sigma APO Macro 150mm F2.8 EX DG HSM', #24
  340. '99 48 76 76 24 24 4B 0E' => 'Sigma APO Macro 150mm F2.8 EX DG OS HSM', #(Christian Hesse)
  341. '48 4C 7C 7C 2C 2C 4B 02' => 'Sigma APO Macro 180mm F3.5 EX DG HSM',
  342. '48 4C 7D 7D 2C 2C 4B 02' => 'Sigma APO Macro 180mm F3.5 EX DG HSM',
  343. '48 54 8E 8E 24 24 4B 02' => 'Sigma APO 300mm F2.8 EX DG HSM',
  344. 'FB 54 8E 8E 24 24 4B 02' => 'Sigma APO 300mm F2.8 EX DG HSM', #26
  345. '26 48 8E 8E 30 30 1C 02' => 'Sigma APO Tele Macro 300mm F4',
  346. '02 2F 98 98 3D 3D 02 00' => 'Sigma APO 400mm F5.6',
  347. '26 3C 98 98 3C 3C 1C 02' => 'Sigma APO Tele Macro 400mm F5.6',
  348. '02 37 A0 A0 34 34 02 00' => 'Sigma APO 500mm F4.5', #19
  349. '48 44 A0 A0 34 34 4B 02' => 'Sigma APO 500mm F4.5 EX HSM',
  350. 'F1 44 A0 A0 34 34 4B 02' => 'Sigma APO 500mm F4.5 EX DG HSM',
  351. '02 34 A0 A0 44 44 02 00' => 'Sigma APO 500mm F7.2',
  352. '02 3C B0 B0 3C 3C 02 00' => 'Sigma APO 800mm F5.6',
  353. '48 3C B0 B0 3C 3C 4B 02' => 'Sigma APO 800mm F5.6 EX HSM',
  354. '9E 38 11 29 34 3C 4B 06' => 'Sigma 8-16mm F4.5-5.6 DC HSM',
  355. 'A1 41 19 31 2C 2C 4B 06' => 'Sigma 10-20mm F3.5 EX DC HSM',
  356. '48 3C 19 31 30 3C 4B 06' => 'Sigma 10-20mm F4-5.6 EX DC HSM',
  357. 'F9 3C 19 31 30 3C 4B 06' => 'Sigma 10-20mm F4-5.6 EX DC HSM', #JD
  358. '48 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 EX DG Aspherical HSM',
  359. 'F0 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 EX DG Aspherical HSM',
  360. '96 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 II DG HSM', #Jurgen Sahlberg
  361. '26 40 27 3F 2C 34 1C 02' => 'Sigma 15-30mm F3.5-4.5 EX DG Aspherical DF',
  362. '48 48 2B 44 24 30 4B 06' => 'Sigma 17-35mm F2.8-4 EX DG Aspherical HSM',
  363. '26 54 2B 44 24 30 1C 02' => 'Sigma 17-35mm F2.8-4 EX Aspherical',
  364. '9D 48 2B 50 24 24 4B 0E' => 'Sigma 17-50mm F2.8 EX DC OS HSM',
  365. '8F 48 2B 50 24 24 4B 0E' => 'Sigma 17-50mm F2.8 EX DC OS HSM', #http://dev.exiv2.org/boards/3/topics/1747
  366. '7A 47 2B 5C 24 34 4B 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF HSM',
  367. '7A 48 2B 5C 24 34 4B 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF HSM',
  368. '7F 48 2B 5C 24 34 1C 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF',
  369. '8E 3C 2B 5C 24 30 4B 0E' => 'Sigma 17-70mm F2.8-4 DC Macro OS HSM Contemporary',
  370. 'A0 48 2A 5C 24 30 4B 0E' => 'Sigma 17-70mm F2.8-4 DC Macro OS HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,5170.0.html
  371. '8B 4C 2D 44 14 14 4B 06' => 'Sigma 18-35mm F1.8 DC HSM', #30/25
  372. '26 40 2D 44 2B 34 1C 02' => 'Sigma 18-35mm F3.5-4.5 Aspherical',
  373. '26 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC',
  374. '7F 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC Macro', #25
  375. '7A 48 2D 50 24 24 4B 06' => 'Sigma 18-50mm F2.8 EX DC Macro',
  376. 'F6 48 2D 50 24 24 4B 06' => 'Sigma 18-50mm F2.8 EX DC Macro',
  377. 'A4 47 2D 50 24 34 4B 0E' => 'Sigma 18-50mm F2.8-4.5 DC OS HSM',
  378. '26 40 2D 50 2C 3C 1C 06' => 'Sigma 18-50mm F3.5-5.6 DC',
  379. '7A 40 2D 50 2C 3C 4B 06' => 'Sigma 18-50mm F3.5-5.6 DC HSM',
  380. '26 40 2D 70 2B 3C 1C 06' => 'Sigma 18-125mm F3.5-5.6 DC',
  381. 'CD 3D 2D 70 2E 3C 4B 0E' => 'Sigma 18-125mm F3.8-5.6 DC OS HSM',
  382. '26 40 2D 80 2C 40 1C 06' => 'Sigma 18-200mm F3.5-6.3 DC',
  383. 'FF 40 2D 80 2C 40 4B 06' => 'Sigma 18-200mm F3.5-6.3 DC', #30
  384. '7A 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 DC OS HSM',
  385. 'ED 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 DC OS HSM', #JD
  386. '90 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 II DC OS HSM', #JohnHelour
  387. 'A5 40 2D 88 2C 40 4B 0E' => 'Sigma 18-250mm F3.5-6.3 DC OS HSM',
  388. # LensFStops varies with FocalLength for this lens (ref 2):
  389. '92 2C 2D 88 2C 40 4B 0E' => 'Sigma 18-250mm F3.5-6.3 DC Macro OS HSM', #2
  390. # '92 2C 2D 88 2C 40 4B 0E' (250mm)
  391. # '92 2B 2D 88 2C 40 4B 0E' (210mm)
  392. # '92 2C 2D 88 2C 40 4B 0E' (185mm)
  393. # '92 2D 2D 88 2C 40 4B 0E' (155mm)
  394. # '92 2E 2D 88 2C 40 4B 0E' (130mm)
  395. # '92 2F 2D 88 2C 40 4B 0E' (105mm)
  396. # '92 30 2D 88 2C 40 4B 0E' (90mm)
  397. # '92 32 2D 88 2C 40 4B 0E' (75mm)
  398. # '92 33 2D 88 2C 40 4B 0E' (62mm)
  399. # '92 35 2D 88 2C 40 4B 0E' (52mm)
  400. # '92 37 2D 88 2C 40 4B 0E' (44mm)
  401. # '92 39 2D 88 2C 40 4B 0E' (38mm)
  402. # '92 3A 2D 88 2C 40 4B 0E' (32mm)
  403. # '92 3E 2D 88 2C 40 4B 0E' (22mm)
  404. # '92 40 2D 88 2C 40 4B 0E' (18mm)
  405. '26 48 31 49 24 24 1C 02' => 'Sigma 20-40mm F2.8',
  406. '02 3A 37 50 31 3D 02 00' => 'Sigma 24-50mm F4-5.6 UC',
  407. '26 48 37 56 24 24 1C 02' => 'Sigma 24-60mm F2.8 EX DG',
  408. 'B6 48 37 56 24 24 1C 02' => 'Sigma 24-60mm F2.8 EX DG',
  409. 'A6 48 37 5C 24 24 4B 06' => 'Sigma 24-70mm F2.8 IF EX DG HSM', #JD
  410. '26 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
  411. '67 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
  412. 'E9 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
  413. '26 40 37 5C 2C 3C 1C 02' => 'Sigma 24-70mm F3.5-5.6 Aspherical HF',
  414. '8A 3C 37 6A 30 30 4B 0E' => 'Sigma 24-105mm F4 DG OS HSM', #33
  415. '26 54 37 73 24 34 1C 02' => 'Sigma 24-135mm F2.8-4.5',
  416. '02 46 3C 5C 25 25 02 00' => 'Sigma 28-70mm F2.8',
  417. '26 54 3C 5C 24 24 1C 02' => 'Sigma 28-70mm F2.8 EX',
  418. '26 48 3C 5C 24 24 1C 06' => 'Sigma 28-70mm F2.8 EX DG',
  419. '79 48 3C 5C 24 24 1C 06' => 'Sigma 28-70mm F2.8 EX DG', #30 ("D" removed)
  420. '26 48 3C 5C 24 30 1C 02' => 'Sigma 28-70mm F2.8-4 DG',
  421. '02 3F 3C 5C 2D 35 02 00' => 'Sigma 28-70mm F3.5-4.5 UC',
  422. '26 40 3C 60 2C 3C 1C 02' => 'Sigma 28-80mm F3.5-5.6 Mini Zoom Macro II Aspherical',
  423. '26 40 3C 65 2C 3C 1C 02' => 'Sigma 28-90mm F3.5-5.6 Macro',
  424. '26 48 3C 6A 24 30 1C 02' => 'Sigma 28-105mm F2.8-4 Aspherical',
  425. '26 3E 3C 6A 2E 3C 1C 02' => 'Sigma 28-105mm F3.8-5.6 UC-III Aspherical IF',
  426. '26 40 3C 80 2C 3C 1C 02' => 'Sigma 28-200mm F3.5-5.6 Compact Aspherical Hyperzoom Macro',
  427. '26 40 3C 80 2B 3C 1C 02' => 'Sigma 28-200mm F3.5-5.6 Compact Aspherical Hyperzoom Macro',
  428. '26 3D 3C 80 2F 3D 1C 02' => 'Sigma 28-300mm F3.8-5.6 Aspherical',
  429. '26 41 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 DG Macro',
  430. 'E6 41 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 DG Macro', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3301.0.html
  431. '26 40 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 Macro',
  432. '02 3B 44 61 30 3D 02 00' => 'Sigma 35-80mm F4-5.6',
  433. '02 40 44 73 2B 36 02 00' => 'Sigma 35-135mm F3.5-4.5 a',
  434. '7A 47 50 76 24 24 4B 06' => 'Sigma 50-150mm F2.8 EX APO DC HSM',
  435. 'FD 47 50 76 24 24 4B 06' => 'Sigma 50-150mm F2.8 EX APO DC HSM II',
  436. '98 48 50 76 24 24 4B 0E' => 'Sigma 50-150mm F2.8 EX APO DC OS HSM', #30
  437. '48 3C 50 A0 30 40 4B 02' => 'Sigma 50-500mm F4-6.3 EX APO RF HSM',
  438. '9F 37 50 A0 34 40 4B 0E' => 'Sigma 50-500mm F4.5-6.3 DG OS HSM', #16
  439. '26 3C 54 80 30 3C 1C 06' => 'Sigma 55-200mm F4-5.6 DC',
  440. '7A 3B 53 80 30 3C 4B 06' => 'Sigma 55-200mm F4-5.6 DC HSM',
  441. '48 54 5C 80 24 24 4B 02' => 'Sigma 70-200mm F2.8 EX APO IF HSM',
  442. '7A 48 5C 80 24 24 4B 06' => 'Sigma 70-200mm F2.8 EX APO DG Macro HSM II',
  443. 'EE 48 5C 80 24 24 4B 06' => 'Sigma 70-200mm F2.8 EX APO DG Macro HSM II', #JD
  444. '9C 48 5C 80 24 24 4B 0E' => 'Sigma 70-200mm F2.8 EX DG OS HSM', #Rolando Ruzic
  445. '02 46 5C 82 25 25 02 00' => 'Sigma 70-210mm F2.8 APO', #JD
  446. '02 40 5C 82 2C 35 02 00' => 'Sigma APO 70-210mm F3.5-4.5',
  447. '26 3C 5C 82 30 3C 1C 02' => 'Sigma 70-210mm F4-5.6 UC-II',
  448. '26 3C 5C 8E 30 3C 1C 02' => 'Sigma 70-300mm F4-5.6 DG Macro',
  449. '56 3C 5C 8E 30 3C 1C 02' => 'Sigma 70-300mm F4-5.6 APO Macro Super II',
  450. 'E0 3C 5C 8E 30 3C 4B 06' => 'Sigma 70-300mm F4-5.6 APO DG Macro HSM', #22
  451. 'A3 3C 5C 8E 30 3C 4B 0E' => 'Sigma 70-300mm F4-5.6 DG OS',
  452. '02 37 5E 8E 35 3D 02 00' => 'Sigma 75-300mm F4.5-5.6 APO',
  453. '02 3A 5E 8E 32 3D 02 00' => 'Sigma 75-300mm F4.0-5.6',
  454. '77 44 61 98 34 3C 7B 0E' => 'Sigma 80-400mm F4.5-5.6 EX OS',
  455. '48 48 68 8E 30 30 4B 02' => 'Sigma APO 100-300mm F4 EX IF HSM',
  456. 'F3 48 68 8E 30 30 4B 02' => 'Sigma APO 100-300mm F4 EX IF HSM',
  457. '48 54 6F 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM',
  458. '7A 54 6E 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM',
  459. 'FA 54 6E 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2787.0.html
  460. 'CF 38 6E 98 34 3C 4B 0E' => 'Sigma APO 120-400mm F4.5-5.6 DG OS HSM',
  461. '26 44 73 98 34 3C 1C 02' => 'Sigma 135-400mm F4.5-5.6 APO Aspherical',
  462. 'CE 34 76 A0 38 40 4B 0E' => 'Sigma 150-500mm F5-6.3 DG OS APO HSM', #JD
  463. '81 34 76 A6 38 40 4B 0E' => 'Sigma 150-600mm F5-6.3 DG OS HSM | S', #Jaap Voets
  464. '82 34 76 A6 38 40 4B 0E' => 'Sigma 150-600mm F5-6.3 DG OS HSM | C',
  465. '26 40 7B A0 34 40 1C 02' => 'Sigma APO 170-500mm F5-6.3 Aspherical RF',
  466. 'A7 49 80 A0 24 24 4B 06' => 'Sigma APO 200-500mm F2.8 EX DG',
  467. '48 3C 8E B0 3C 3C 4B 02' => 'Sigma APO 300-800mm F5.6 EX DG HSM',
  468. #
  469. '00 47 25 25 24 24 00 02' => 'Tamron SP AF 14mm f/2.8 Aspherical (IF) (69E)',
  470. 'E8 4C 44 44 14 14 DF 0E' => 'Tamron SP 35mm f/1.8 VC', #35
  471. 'F4 54 56 56 18 18 84 06' => 'Tamron SP AF 60mm f/2.0 Di II Macro 1:1 (G005)', #24
  472. '1E 5D 64 64 20 20 13 00' => 'Tamron SP AF 90mm f/2.5 (52E)',
  473. '20 5A 64 64 20 20 14 00' => 'Tamron SP AF 90mm f/2.5 Macro (152E)',
  474. '22 53 64 64 24 24 E0 02' => 'Tamron SP AF 90mm f/2.8 Macro 1:1 (72E)',
  475. '32 53 64 64 24 24 35 02' => 'Tamron SP AF 90mm f/2.8 [Di] Macro 1:1 (172E/272E)',
  476. 'F8 55 64 64 24 24 84 06' => 'Tamron SP AF 90mm f/2.8 Di Macro 1:1 (272NII)',
  477. 'F8 54 64 64 24 24 DF 06' => 'Tamron SP AF 90mm f/2.8 Di Macro 1:1 (272NII)',
  478. 'FE 54 64 64 24 24 DF 0E' => 'Tamron SP 90mm f/2.8 Di VC USD Macro 1:1 (F004)', #Jurgen Sahlberg
  479. '00 4C 7C 7C 2C 2C 00 02' => 'Tamron SP AF 180mm f/3.5 Di Model (B01)',
  480. '21 56 8E 8E 24 24 14 00' => 'Tamron SP AF 300mm f/2.8 LD-IF (60E)',
  481. '27 54 8E 8E 24 24 1D 02' => 'Tamron SP AF 300mm f/2.8 LD-IF (360E)',
  482. 'F6 3F 18 37 2C 34 84 06' => 'Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical (IF) (B001)',
  483. 'F6 3F 18 37 2C 34 DF 06' => 'Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical (IF) (B001)', #30
  484. '00 36 1C 2D 34 3C 00 06' => 'Tamron SP AF 11-18mm f/4.5-5.6 Di II LD Aspherical (IF) (A13)',
  485. 'E9 48 27 3E 24 24 DF 0E' => 'Tamron SP 15-30mm f/2.8 Di VC USD (A012)', #33
  486. 'EA 40 29 8E 2C 40 DF 0E' => 'Tamron AF 16-300mm f/3.5-6.3 Di II VC PZD (B016)',
  487. '07 46 2B 44 24 30 03 02' => 'Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical (IF) (A05)',
  488. '00 53 2B 50 24 24 00 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16)', #PH
  489. '00 54 2B 50 24 24 00 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16NII)',
  490. 'FB 54 2B 50 24 24 84 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16NII)', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3787.0.html
  491. 'F3 54 2B 50 24 24 84 0E' => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical (IF) (B005)',
  492. '00 3F 2D 80 2B 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) (A14)',
  493. '00 3F 2D 80 2C 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14)',
  494. '00 40 2D 80 2C 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14NII)', #25
  495. 'FC 40 2D 80 2C 40 DF 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14NII)', #PH (NC)
  496. '00 40 2D 88 2C 40 62 06' => 'Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical (IF) Macro (A18)',
  497. '00 40 2D 88 2C 40 00 06' => 'Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical (IF) Macro (A18NII)', #JD
  498. 'F5 40 2C 8A 2C 40 40 0E' => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical (IF) Macro (B003)',
  499. 'F0 3F 2D 8A 2C 40 DF 0E' => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD (B008)',
  500. '07 40 2F 44 2C 34 03 02' => 'Tamron AF 19-35mm f/3.5-4.5 (A10)',
  501. '07 40 30 45 2D 35 03 02' => 'Tamron AF 19-35mm f/3.5-4.5 (A10)',
  502. '00 49 30 48 22 2B 00 02' => 'Tamron SP AF 20-40mm f/2.7-3.5 (166D)',
  503. '0E 4A 31 48 23 2D 0E 02' => 'Tamron SP AF 20-40mm f/2.7-3.5 (166D)',
  504. 'FE 48 37 5C 24 24 DF 0E' => 'Tamron SP 24-70mm f/2.8 Di VC USD (A007)', #24
  505. '45 41 37 72 2C 3C 48 02' => 'Tamron SP AF 24-135mm f/3.5-5.6 AD Aspherical (IF) Macro (190D)',
  506. '33 54 3C 5E 24 24 62 02' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09)',
  507. 'FA 54 3C 5E 24 24 84 06' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09NII)', #JD
  508. 'FA 54 3C 5E 24 24 DF 06' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09NII)',
  509. '10 3D 3C 60 2C 3C D2 02' => 'Tamron AF 28-80mm f/3.5-5.6 Aspherical (177D)',
  510. '45 3D 3C 60 2C 3C 48 02' => 'Tamron AF 28-80mm f/3.5-5.6 Aspherical (177D)',
  511. '00 48 3C 6A 24 24 00 02' => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF (176D)',
  512. '4D 3E 3C 80 2E 3C 62 02' => 'Tamron AF 28-200mm F/3.8-5.6 XR Aspherical (IF) Macro (A03N)',
  513. '0B 3E 3D 7F 2F 3D 0E 00' => 'Tamron AF 28-200mm f/3.8-5.6 (71D)',
  514. '0B 3E 3D 7F 2F 3D 0E 02' => 'Tamron AF 28-200mm f/3.8-5.6D (171D)',
  515. '12 3D 3C 80 2E 3C DF 02' => 'Tamron AF 28-200mm f/3.8-5.6 AF Aspherical LD (IF) (271D)',
  516. '4D 41 3C 8E 2B 40 62 02' => 'Tamron AF 28-300mm f/3.5-6.3 XR Di LD Aspherical (IF) (A061)',
  517. '4D 41 3C 8E 2C 40 62 02' => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical (IF) (185D)',
  518. 'F9 40 3C 8E 2C 40 40 0E' => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical (IF) Macro (A20)',
  519. '00 47 53 80 30 3C 00 06' => 'Tamron AF 55-200mm f/4-5.6 Di II LD (A15)',
  520. 'F7 53 5C 80 24 24 84 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
  521. 'FE 53 5C 80 24 24 84 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
  522. 'F7 53 5C 80 24 24 40 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
  523. # 'FE 54 5C 80 24 24 DF 0E' => 'Tamron SP AF 70-200mm f/2.8 Di VC USD (A009)',
  524. 'FE 54 5C 80 24 24 DF 0E' => 'Tamron SP 70-200mm f/2.8 Di VC USD (A009)', #25
  525. '69 48 5C 8E 30 3C 6F 02' => 'Tamron AF 70-300mm f/4-5.6 LD Macro 1:2 (572D/772D)',
  526. '69 47 5C 8E 30 3C 00 02' => 'Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2 (A17N)',
  527. '00 48 5C 8E 30 3C 00 06' => 'Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2 (A17NII)', #JD
  528. 'F1 47 5C 8E 30 3C DF 0E' => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A005)',
  529. 'EB 40 76 A6 38 40 DF 0E' => 'Tamron SP AF 150-600mm f/5-6.3 VC USD (A011)',
  530. '20 3C 80 98 3D 3D 1E 02' => 'Tamron AF 200-400mm f/5.6 LD IF (75D)',
  531. '00 3E 80 A0 38 3F 00 02' => 'Tamron SP AF 200-500mm f/5-6.3 Di LD (IF) (A08)',
  532. '00 3F 80 A0 38 3F 00 02' => 'Tamron SP AF 200-500mm f/5-6.3 Di (A08)',
  533. #
  534. '00 40 2B 2B 2C 2C 00 02' => 'Tokina AT-X 17 AF PRO (AF 17mm f/3.5)',
  535. '00 47 44 44 24 24 00 06' => 'Tokina AT-X M35 PRO DX (AF 35mm f/2.8 Macro)',
  536. '00 54 68 68 24 24 00 02' => 'Tokina AT-X M100 AF PRO D (AF 100mm f/2.8 Macro)',
  537. '27 48 8E 8E 30 30 1D 02' => 'Tokina AT-X 304 AF (AF 300mm f/4.0)',
  538. '00 54 8E 8E 24 24 00 02' => 'Tokina AT-X 300 AF PRO (AF 300mm f/2.8)',
  539. '12 3B 98 98 3D 3D 09 00' => 'Tokina AT-X 400 AF SD (AF 400mm f/5.6)',
  540. '00 40 18 2B 2C 34 00 06' => 'Tokina AT-X 107 AF DX Fisheye (AF 10-17mm f/3.5-4.5)',
  541. '00 48 1C 29 24 24 00 06' => 'Tokina AT-X 116 PRO DX (AF 11-16mm f/2.8)',
  542. '7A 48 1C 29 24 24 7E 06' => 'Tokina AT-X 116 PRO DX II (AF 11-16mm f/2.8)',
  543. '7A 48 1C 30 24 24 7E 06' => 'Tokina AT-X 11-20 F2.8 PRO DX (AF 11-20mm f/2.8)',
  544. '00 3C 1F 37 30 30 00 06' => 'Tokina AT-X 124 AF PRO DX (AF 12-24mm f/4)',
  545. '7A 3C 1F 37 30 30 7E 06.2' => 'Tokina AT-X 124 AF PRO DX II (AF 12-24mm f/4)',
  546. '7A 3C 1F 3C 30 30 7E 06' => 'Tokina AT-X 12-28 PRO DX (AF 12-28mm F/4)',
  547. '00 48 29 3C 24 24 00 06' => 'Tokina AT-X 16-28 AF PRO FX (AF 16-28mm f/2.8)',
  548. '00 48 29 50 24 24 00 06' => 'Tokina AT-X 165 PRO DX (AF 16-50mm f/2.8)',
  549. '00 40 2A 72 2C 3C 00 06' => 'Tokina AT-X 16.5-135 DX (AF 16.5-135mm F3.5-5.6)',
  550. '00 3C 2B 44 30 30 00 06' => 'Tokina AT-X 17-35 F4 PRO FX (AF 17-35mm f/4)',
  551. '2F 40 30 44 2C 34 29 02.2' => 'Tokina AF 193 (AF 19-35mm f/3.5-4.5)',
  552. '2F 48 30 44 24 24 29 02.2' => 'Tokina AT-X 235 AF PRO (AF 20-35mm f/2.8)',
  553. '2F 40 30 44 2C 34 29 02.1' => 'Tokina AF 235 II (AF 20-35mm f/3.5-4.5)',
  554. '00 48 37 5C 24 24 00 06' => 'Tokina AT-X 24-70 F2.8 PRO FX (AF 24-70mm f/2.8)',
  555. '00 40 37 80 2C 3C 00 02' => 'Tokina AT-X 242 AF (AF 24-200mm f/3.5-5.6)',
  556. '25 48 3C 5C 24 24 1B 02.1' => 'Tokina AT-X 270 AF PRO II (AF 28-70mm f/2.6-2.8)',
  557. '25 48 3C 5C 24 24 1B 02.2' => 'Tokina AT-X 287 AF PRO SV (AF 28-70mm f/2.8)',
  558. '07 48 3C 5C 24 24 03 00' => 'Tokina AT-X 287 AF (AF 28-70mm f/2.8)',
  559. '07 47 3C 5C 25 35 03 00' => 'Tokina AF 287 SD (AF 28-70mm f/2.8-4.5)',
  560. '07 40 3C 5C 2C 35 03 00' => 'Tokina AF 270 II (AF 28-70mm f/3.5-4.5)',
  561. '00 48 3C 60 24 24 00 02' => 'Tokina AT-X 280 AF PRO (AF 28-80mm f/2.8)',
  562. '25 44 44 8E 34 42 1B 02' => 'Tokina AF 353 (AF 35-300mm f/4.5-6.7)',
  563. '00 48 50 72 24 24 00 06' => 'Tokina AT-X 535 PRO DX (AF 50-135mm f/2.8)',
  564. '00 3C 5C 80 30 30 00 0E' => 'Tokina AT-X 70-200 F4 FX VCM-S (AF 70-200mm f/4)',
  565. '00 48 5C 80 30 30 00 0E' => 'Tokina AT-X 70-200 F4 FX VCM-S (AF 70-200mm f/4)',
  566. '12 44 5E 8E 34 3C 09 00' => 'Tokina AF 730 (AF 75-300mm F4.5-5.6)',
  567. '14 54 60 80 24 24 0B 00' => 'Tokina AT-X 828 AF (AF 80-200mm f/2.8)',
  568. '24 54 60 80 24 24 1A 02' => 'Tokina AT-X 828 AF PRO (AF 80-200mm f/2.8)',
  569. '24 44 60 98 34 3C 1A 02' => 'Tokina AT-X 840 AF-II (AF 80-400mm f/4.5-5.6)',
  570. '00 44 60 98 34 3C 00 02' => 'Tokina AT-X 840 D (AF 80-400mm f/4.5-5.6)',
  571. '14 48 68 8E 30 30 0B 00' => 'Tokina AT-X 340 AF (AF 100-300mm f/4)',
  572. #
  573. '06 3F 68 68 2C 2C 06 00' => 'Cosina AF 100mm F3.5 Macro',
  574. '07 36 3D 5F 2C 3C 03 00' => 'Cosina AF Zoom 28-80mm F3.5-5.6 MC Macro',
  575. '07 46 3D 6A 25 2F 03 00' => 'Cosina AF Zoom 28-105mm F2.8-3.8 MC',
  576. '12 36 5C 81 35 3D 09 00' => 'Cosina AF Zoom 70-210mm F4.5-5.6 MC Macro',
  577. '12 39 5C 8E 34 3D 08 02' => 'Cosina AF Zoom 70-300mm F4.5-5.6 MC Macro',
  578. '12 3B 68 8D 3D 43 09 02' => 'Cosina AF Zoom 100-300mm F5.6-6.7 MC Macro',
  579. #
  580. '12 38 69 97 35 42 09 02' => 'Promaster Spectrum 7 100-400mm F4.5-6.7',
  581. #
  582. '00 40 31 31 2C 2C 00 00' => 'Voigtlander Color Skopar 20mm F3.5 SLII Aspherical',
  583. '00 48 3C 3C 24 24 00 00' => 'Voigtlander Color Skopar 28mm F2.8 SL II',
  584. '00 54 48 48 18 18 00 00' => 'Voigtlander Ultron 40mm F2 SLII Aspherical',
  585. '00 54 55 55 0C 0C 00 00' => 'Voigtlander Nokton 58mm F1.4 SLII',
  586. '00 40 64 64 2C 2C 00 00' => 'Voigtlander APO-Lanthar 90mm F3.5 SLII Close Focus',
  587. #
  588. '00 40 2D 2D 2C 2C 00 00' => 'Carl Zeiss Distagon T* 3.5/18 ZF.2',
  589. '00 48 32 32 24 24 00 00' => 'Carl Zeiss Distagon T* 2.8/21 ZF.2',
  590. '00 54 3C 3C 18 18 00 00' => 'Carl Zeiss Distagon T* 2/28 ZF.2',
  591. '00 54 44 44 0C 0C 00 00' => 'Carl Zeiss Distagon T* 1.4/35 ZF.2',
  592. '00 54 44 44 18 18 00 00' => 'Carl Zeiss Distagon T* 2/35 ZF.2',
  593. '00 54 50 50 0C 0C 00 00' => 'Carl Zeiss Planar T* 1.4/50 ZF.2',
  594. '00 54 50 50 18 18 00 00' => 'Carl Zeiss Makro-Planar T* 2/50 ZF.2',
  595. '00 54 62 62 0C 0C 00 00' => 'Carl Zeiss Planar T* 1.4/85 ZF.2',
  596. '00 54 68 68 18 18 00 00' => 'Carl Zeiss Makro-Planar T* 2/100 ZF.2',
  597. '00 54 72 72 18 18 00 00' => 'Carl Zeiss Apo Sonnar T* 2/135 ZF.2',
  598. '00 54 53 53 0C 0C 00 00' => 'Zeiss Otus 1.4/55', #33
  599. '01 54 62 62 0C 0C 00 00' => 'Zeiss Otus 1.4/85',
  600. '52 54 44 44 18 18 00 00' => 'Zeiss Milvus 35mm f/2',
  601. '53 54 50 50 0C 0C 00 00' => 'Zeiss Milvus 50mm f/1.4', #33
  602. '54 54 50 50 18 18 00 00' => 'Zeiss Milvus 50mm f/2 Macro',
  603. '55 54 62 62 0C 0C 00 00' => 'Zeiss Milvus 85mm f/1.4', #33
  604. '56 54 68 68 18 18 00 00' => 'Zeiss Milvus 100mm f/2 Macro',
  605. #
  606. '00 54 56 56 30 30 00 00' => 'Coastal Optical Systems 60mm 1:4 UV-VIS-IR Macro Apo',
  607. #
  608. '4A 40 11 11 2C 0C 4D 02' => 'Samyang 8mm f/3.5 Fish-Eye CS',
  609. '4A 48 1E 1E 24 0C 4D 02' => 'Samyang 12mm f/2.8 ED AS NCS Fish-Eye', #Jurgen Sahlberg
  610. '4A 48 24 24 24 0C 4D 02' => 'Samyang AE 14mm f/2.8 ED AS IF UMC', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3150.0.html
  611. '4A 54 29 29 18 0C 4D 02' => 'Samyang 16mm F2.0 ED AS UMC CS', #Jon Bloom (by email)
  612. '4A 60 44 44 0C 0C 4D 02' => 'Samyang 35mm f/1.4 AS UMC',
  613. '4A 60 62 62 0C 0C 4D 02' => 'Samyang AE 85mm f/1.4 AS IF UMC', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2888.0.html
  614. #
  615. '02 40 44 5C 2C 34 02 00' => 'Exakta AF 35-70mm 1:3.5-4.5 MC',
  616. #
  617. '07 3E 30 43 2D 35 03 00' => 'Soligor AF Zoom 19-35mm 1:3.5-4.5 MC',
  618. '03 43 5C 81 35 35 02 00' => 'Soligor AF C/D Zoom UMCS 70-210mm 1:4.5',
  619. '12 4A 5C 81 31 3D 09 00' => 'Soligor AF C/D Auto Zoom+Macro 70-210mm 1:4-5.6 UMCS',
  620. '12 36 69 97 35 42 09 00' => 'Soligor AF Zoom 100-400mm 1:4.5-6.7 MC',
  621. #
  622. '00 00 00 00 00 00 00 01' => 'Manual Lens No CPU',
  623. #
  624. '00 00 48 48 53 53 00 01' => 'Loreo 40mm F11-22 3D Lens in a Cap 9005', #PH
  625. '00 47 10 10 24 24 00 00' => 'Fisheye Nikkor 8mm f/2.8 AiS',
  626. '00 47 3C 3C 24 24 00 00' => 'Nikkor 28mm f/2.8 AiS', #35
  627. # '00 54 44 44 0C 0C 00 00' => 'Nikkor 35mm f/1.4 AiS', comment out in favour of Zeiss with same ID because this lens is rare (requires CPU upgrade)
  628. '00 57 50 50 14 14 00 00' => 'Nikkor 50mm f/1.8 AI', #35
  629. '00 48 50 50 18 18 00 00' => 'Nikkor H 50mm f/2',
  630. '00 48 68 68 24 24 00 00' => 'Series E 100mm f/2.8',
  631. '00 4C 6A 6A 20 20 00 00' => 'Nikkor 105mm f/2.5 AiS',
  632. '00 48 80 80 30 30 00 00' => 'Nikkor 200mm f/4 AiS',
  633. '00 40 11 11 2C 2C 00 00' => 'Samyang 8mm f/3.5 Fish-Eye',
  634. '00 58 64 64 20 20 00 00' => 'Soligor C/D Macro MC 90mm f/2.5',
  635. );
  636. # text encoding used in LocationInfo (ref PH)
  637. %nikonTextEncoding = (
  638. 0 => 'n/a',
  639. 1 => 'UTF8',
  640. # UTF16 is a guess here: it could also be Unicode or JIS,
  641. # but I chose UTF16 due to the similarity with the QuickTime stringEncoding
  642. 2 => 'UTF16',
  643. );
  644. # flash firmware decoding (ref JD)
  645. my %flashFirmware = (
  646. '0 0' => 'n/a',
  647. '1 1' => '1.01 (SB-800 or Metz 58 AF-1)',
  648. '1 3' => '1.03 (SB-800)',
  649. '2 1' => '2.01 (SB-800)',
  650. '2 4' => '2.04 (SB-600)',
  651. '2 5' => '2.05 (SB-600)',
  652. '3 1' => '3.01 (SU-800 Remote Commander)',
  653. '4 1' => '4.01 (SB-400)',
  654. '4 2' => '4.02 (SB-400)',
  655. '4 4' => '4.04 (SB-400)',
  656. '5 1' => '5.01 (SB-900)',
  657. '5 2' => '5.02 (SB-900)',
  658. '6 1' => '6.01 (SB-700)', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,5034.0.html
  659. '7 1' => '7.01 (SB-910)', #PH
  660. OTHER => sub {
  661. my ($val, $inv) = @_;
  662. return sprintf('%d.%.2d (Unknown model)', split(' ', $val)) unless $inv;
  663. return "$1 $2" if $val =~ /(\d+)\.(\d+)/;
  664. return '0 0';
  665. },
  666. );
  667. # flash Guide Number (GN) distance settings (ref 28)
  668. my %flashGNDistance = (
  669. 0 => 0, 19 => '2.8 m',
  670. 1 => '0.1 m', 20 => '3.2 m',
  671. 2 => '0.2 m', 21 => '3.6 m',
  672. 3 => '0.3 m', 22 => '4.0 m',
  673. 4 => '0.4 m', 23 => '4.5 m',
  674. 5 => '0.5 m', 24 => '5.0 m',
  675. 6 => '0.6 m', 25 => '5.6 m',
  676. 7 => '0.7 m', 26 => '6.3 m',
  677. 8 => '0.8 m', 27 => '7.1 m',
  678. 9 => '0.9 m', 28 => '8.0 m',
  679. 10 => '1.0 m', 29 => '9.0 m',
  680. 11 => '1.1 m', 30 => '10.0 m',
  681. 12 => '1.3 m', 31 => '11.0 m',
  682. 13 => '1.4 m', 32 => '13.0 m',
  683. 14 => '1.6 m', 33 => '14.0 m',
  684. 15 => '1.8 m', 34 => '16.0 m',
  685. 16 => '2.0 m', 35 => '18.0 m',
  686. 17 => '2.2 m', 36 => '20.0 m',
  687. 18 => '2.5 m', 255 => 'n/a',
  688. );
  689. # flash control mode values (ref JD)
  690. my %flashControlMode = (
  691. 0x00 => 'Off',
  692. 0x01 => 'iTTL-BL',
  693. 0x02 => 'iTTL',
  694. 0x03 => 'Auto Aperture',
  695. 0x04 => 'Automatic', #28
  696. 0x05 => 'GN (distance priority)', #28 (Guide Number, but called "GN" in manual)
  697. 0x06 => 'Manual',
  698. 0x07 => 'Repeating Flash',
  699. );
  700. my %retouchValues = ( #PH
  701. 0 => 'None',
  702. 3 => 'B & W',
  703. 4 => 'Sepia',
  704. 5 => 'Trim',
  705. 6 => 'Small Picture',
  706. 7 => 'D-Lighting',
  707. 8 => 'Red Eye',
  708. 9 => 'Cyanotype',
  709. 10 => 'Sky Light',
  710. 11 => 'Warm Tone',
  711. 12 => 'Color Custom',
  712. 13 => 'Image Overlay',
  713. 14 => 'Red Intensifier',
  714. 15 => 'Green Intensifier',
  715. 16 => 'Blue Intensifier',
  716. 17 => 'Cross Screen',
  717. 18 => 'Quick Retouch',
  718. 19 => 'NEF Processing',
  719. 23 => 'Distortion Control',
  720. 25 => 'Fisheye',
  721. 26 => 'Straighten',
  722. 29 => 'Perspective Control',
  723. 30 => 'Color Outline',
  724. 31 => 'Soft Filter',
  725. 32 => 'Resize', #31
  726. 33 => 'Miniature Effect',
  727. 34 => 'Skin Softening', # (S9200)
  728. 35 => 'Selected Frame', #31 (frame exported from MOV)
  729. 37 => 'Color Sketch', #31
  730. 38 => 'Selective Color', # (S9200)
  731. 40 => 'Drawing', # (S9200)
  732. );
  733. # AF point indices for models with 51 focus points, eg. D3 (ref JD/PH)
  734. # A1 A2 A3 A4 A5 A6 A7 A8 A9
  735. # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11
  736. # C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11
  737. # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11
  738. # E1 E2 E3 E4 E5 E6 E7 E8 E9
  739. my %afPoints51 = (
  740. 1 => 'C6', 11 => 'C5', 21 => 'C9', 31 => 'C11',41 => 'A2', 51 => 'D1',
  741. 2 => 'B6', 12 => 'B5', 22 => 'B9', 32 => 'B11',42 => 'D3',
  742. 3 => 'A5', 13 => 'A4', 23 => 'A8', 33 => 'D11',43 => 'E2',
  743. 4 => 'D6', 14 => 'D5', 24 => 'D9', 34 => 'C4', 44 => 'C2',
  744. 5 => 'E5', 15 => 'E4', 25 => 'E8', 35 => 'B4', 45 => 'B2',
  745. 6 => 'C7', 16 => 'C8', 26 => 'C10',36 => 'A3', 46 => 'A1',
  746. 7 => 'B7', 17 => 'B8', 27 => 'B10',37 => 'D4', 47 => 'D2',
  747. 8 => 'A6', 18 => 'A7', 28 => 'A9', 38 => 'E3', 48 => 'E1',
  748. 9 => 'D7', 19 => 'D8', 29 => 'D10',39 => 'C3', 49 => 'C1',
  749. 10 => 'E6', 20 => 'E7', 30 => 'E9', 40 => 'B3', 50 => 'B1',
  750. );
  751. # AF point indices for models with 39 focus points, eg. D7000 (ref 29)
  752. # A1 A2 A3
  753. # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11
  754. # C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11
  755. # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11
  756. # E1 E2 E3
  757. my %afPoints39 = (
  758. 1 => 'C6', 11 => 'C5', 21 => 'D9', 31 => 'C3',
  759. 2 => 'B6', 12 => 'B5', 22 => 'C10',32 => 'B3',
  760. 3 => 'A2', 13 => 'A1', 23 => 'B10',33 => 'D3',
  761. 4 => 'D6', 14 => 'D5', 24 => 'D10',34 => 'C2',
  762. 5 => 'E2', 15 => 'E1', 25 => 'C11',35 => 'B2',
  763. 6 => 'C7', 16 => 'C8', 26 => 'B11',36 => 'D2',
  764. 7 => 'B7', 17 => 'B8', 27 => 'D11',37 => 'C1',
  765. 8 => 'A3', 18 => 'D8', 28 => 'C4', 38 => 'B1',
  766. 9 => 'D7', 19 => 'C9', 29 => 'B4', 39 => 'D1',
  767. 10 => 'E3', 20 => 'B9', 30 => 'D4',
  768. );
  769. # AF point indices for models with 135 focus points, eg. 1J1 (ref PH)
  770. # - 9 rows (A-I) with 15 columns (1-15), center is E8
  771. # - odd columns, columns 2 and 14, and the remaining corner points are
  772. # not used in 41-point mode
  773. my %afPoints135 = (
  774. 1 => 'E8', 28 => 'E10', 55 => 'E13', 82 => 'E6', 109 => 'E3',
  775. 2 => 'D8', 29 => 'D10', 56 => 'D13', 83 => 'D6', 110 => 'D3',
  776. 3 => 'C8', 30 => 'C10', 57 => 'C13', 84 => 'C6', 111 => 'C3',
  777. 4 => 'B8', 31 => 'B10', 58 => 'B13', 85 => 'B6', 112 => 'B3',
  778. 5 => 'A8', 32 => 'A10', 59 => 'A13', 86 => 'A6', 113 => 'A3',
  779. 6 => 'F8', 33 => 'F10', 60 => 'F13', 87 => 'F6', 114 => 'F3',
  780. 7 => 'G8', 34 => 'G10', 61 => 'G13', 88 => 'G6', 115 => 'G3',
  781. 8 => 'H8', 35 => 'H10', 62 => 'H13', 89 => 'H6', 116 => 'H3',
  782. 9 => 'I8', 36 => 'I10', 63 => 'I13', 90 => 'I6', 117 => 'I3',
  783. 10 => 'E9', 37 => 'E11', 64 => 'E14', 91 => 'E5', 118 => 'E2',
  784. 11 => 'D9', 38 => 'D11', 65 => 'D14', 92 => 'D5', 119 => 'D2',
  785. 12 => 'C9', 39 => 'C11', 66 => 'C14', 93 => 'C5', 120 => 'C2',
  786. 13 => 'B9', 40 => 'B11', 67 => 'B14', 94 => 'B5', 121 => 'B2',
  787. 14 => 'A9', 41 => 'A11', 68 => 'A14', 95 => 'A5', 122 => 'A2',
  788. 15 => 'F9', 42 => 'F11', 69 => 'F14', 96 => 'F5', 123 => 'F2',
  789. 16 => 'G9', 43 => 'G11', 70 => 'G14', 97 => 'G5', 124 => 'G2',
  790. 17 => 'H9', 44 => 'H11', 71 => 'H14', 98 => 'H5', 125 => 'H2',
  791. 18 => 'I9', 45 => 'I11', 72 => 'I14', 99 => 'I5', 126 => 'I2',
  792. 19 => 'E7', 46 => 'E12', 73 => 'E15', 100 => 'E4', 127 => 'E1',
  793. 20 => 'D7', 47 => 'D12', 74 => 'D15', 101 => 'D4', 128 => 'D1',
  794. 21 => 'C7', 48 => 'C12', 75 => 'C15', 102 => 'C4', 129 => 'C1',
  795. 22 => 'B7', 49 => 'B12', 76 => 'B15', 103 => 'B4', 130 => 'B1',
  796. 23 => 'A7', 50 => 'A12', 77 => 'A15', 104 => 'A4', 131 => 'A1',
  797. 24 => 'F7', 51 => 'F12', 78 => 'F15', 105 => 'F4', 132 => 'F1',
  798. 25 => 'G7', 52 => 'G12', 79 => 'G15', 106 => 'G4', 133 => 'G1',
  799. 26 => 'H7', 53 => 'H12', 80 => 'H15', 107 => 'H4', 134 => 'H1',
  800. 27 => 'I7', 54 => 'I12', 81 => 'I15', 108 => 'I4', 135 => 'I1',
  801. );
  802. my %offOn = ( 0 => 'Off', 1 => 'On' );
  803. # common attributes for writable BinaryData directories
  804. my %binaryDataAttrs = (
  805. PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
  806. WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
  807. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  808. WRITABLE => 1,
  809. FIRST_ENTRY => 0,
  810. );
  811. # Nikon maker note tags
  812. %Image::ExifTool::Nikon::Main = (
  813. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikon,
  814. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikon,
  815. CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
  816. WRITABLE => 1,
  817. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  818. PRINT_CONV => \&FormatString,
  819. 0x0001 => { #2
  820. # the format differs for different models. for D70, this is a string '0210',
  821. # but for the E775 it is binary: "\x00\x01\x00\x00"
  822. Name => 'MakerNoteVersion',
  823. Writable => 'undef',
  824. Count => 4,
  825. # convert to string if binary
  826. ValueConv => '$_=$val; /^[\x00-\x09]/ and $_=join("",unpack("CCCC",$_)); $_',
  827. ValueConvInv => '$val',
  828. PrintConv => '$_=$val;s/^(\d{2})/$1\./;s/^0//;$_',
  829. PrintConvInv => '$_=$val;s/\.//;"0$_"',
  830. },
  831. 0x0002 => {
  832. # this is the ISO actually used by the camera
  833. # (may be different than ISO setting if auto)
  834. Name => 'ISO',
  835. Writable => 'int16u',
  836. Count => 2,
  837. Priority => 0, # the EXIF ISO is more reliable
  838. Groups => { 2 => 'Image' },
  839. # D300 sets this to undef with 4 zero bytes when LO ISO is used - PH
  840. RawConv => '$val eq "\0\0\0\0" ? undef : $val',
  841. # first number is 1 for "Hi ISO" modes (H0.3, H0.7 and H1.0 on D80) - PH
  842. PrintConv => '$_=$val;s/^0 //;s/^1 (\d+)/Hi $1/;$_',
  843. PrintConvInv => '$_=$val;/^\d+/ ? "0 $_" : (s/Hi ?//i ? "1 $_" : $_)',
  844. },
  845. # Note: we attempt to fix the case of these string values (typically written in all caps)
  846. 0x0003 => { Name => 'ColorMode', Writable => 'string' },
  847. 0x0004 => { Name => 'Quality', Writable => 'string' },
  848. 0x0005 => { Name => 'WhiteBalance', Writable => 'string' },
  849. 0x0006 => { Name => 'Sharpness', Writable => 'string' },
  850. 0x0007 => { Name => 'FocusMode', Writable => 'string' },
  851. # FlashSetting (better named FlashSyncMode, ref 28) values:
  852. # "Normal", "Slow", "Rear Slow", "RED-EYE", "RED-EYE SLOW"
  853. 0x0008 => { Name => 'FlashSetting', Writable => 'string' },
  854. # FlashType observed values:
  855. # internal: "Built-in,TTL", "Built-in,RPT", "Comdr.", "NEW_TTL"
  856. # external: "Optional,TTL", "Optional,RPT", "Optional,M", "Comdr."
  857. # both: "Built-in,TTL&Comdr."
  858. # no flash: ""
  859. 0x0009 => { Name => 'FlashType', Writable => 'string' }, #2 (count varies by model - PH)
  860. # 0x000a - rational values: 5.6 to 9.33 - found in Coolpix models - PH
  861. # (seems constant for a given camera model, but not correlated with scale factor)
  862. 0x000b => { #2
  863. Name => 'WhiteBalanceFineTune',
  864. Writable => 'int16s',
  865. Count => -1, # older models write 1 value, newer DSLR's write 2 - PH
  866. },
  867. 0x000c => { # (D1X)
  868. Name => 'WB_RBLevels',
  869. Writable => 'rational64u',
  870. Count => 4, # (not sure what the last 2 values are for)
  871. },
  872. 0x000d => { #15
  873. Name => 'ProgramShift',
  874. Writable => 'undef',
  875. Count => 4,
  876. ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
  877. ValueConvInv => q{
  878. my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
  879. $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
  880. },
  881. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  882. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  883. },
  884. 0x000e => {
  885. Name => 'ExposureDifference',
  886. Writable => 'undef',
  887. Count => 4,
  888. ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
  889. ValueConvInv => q{
  890. my $a = int($val*12 + ($val>0 ? 0.5 : -0.5));
  891. $a<-128 or $a>127 ? undef : pack("c4",$a,1,12,0);
  892. },
  893. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  894. PrintConvInv => '$val',
  895. },
  896. 0x000f => { Name => 'ISOSelection', Writable => 'string' }, #2
  897. 0x0010 => {
  898. Name => 'DataDump',
  899. Writable => 0,
  900. Binary => 1,
  901. },
  902. 0x0011 => {
  903. Name => 'PreviewIFD',
  904. Groups => { 1 => 'PreviewIFD', 2 => 'Image' },
  905. Flags => 'SubIFD',
  906. SubDirectory => {
  907. TagTable => 'Image::ExifTool::Nikon::PreviewIFD',
  908. Start => '$val',
  909. },
  910. },
  911. 0x0012 => { #2 (camera setting: combination of command dial and menus - PH)
  912. Name => 'FlashExposureComp',
  913. Description => 'Flash Exposure Compensation',
  914. Writable => 'undef',
  915. Count => 4,
  916. # (includes the built-in compensation for FlashType "Built-in,TTL&Comdr.")
  917. Notes => q{
  918. may be set even if flash does not fire. Does not include the effect of
  919. flash bracketing.
  920. },
  921. ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
  922. ValueConvInv => q{
  923. my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
  924. $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
  925. },
  926. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  927. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  928. },
  929. # D70 - another ISO tag
  930. 0x0013 => { #2
  931. Name => 'ISOSetting',
  932. Writable => 'int16u',
  933. Count => 2,
  934. PrintConv => '$_=$val;s/^0 //;$_',
  935. PrintConvInv => '"0 $val"',
  936. },
  937. 0x0014 => [
  938. { #4
  939. Name => 'ColorBalanceA',
  940. Condition => '$format eq "undef" and $count == 2560',
  941. SubDirectory => {
  942. TagTable => 'Image::ExifTool::Nikon::ColorBalanceA',
  943. ByteOrder => 'BigEndian',
  944. },
  945. },
  946. { #PH
  947. Name => 'NRWData',
  948. Condition => '$$valPt =~ /^NRW/', # starts with "NRW 0100"
  949. Notes => 'large unknown block in NRW images, not copied to JPEG images',
  950. # 'Drop' because not found in JPEG images (too large for APP1 anyway)
  951. Flags => [ 'Unknown', 'Binary', 'Drop' ],
  952. },
  953. ],
  954. # 0x0015 - string[8]: "AUTO "
  955. # D70 Image boundary?? top x,y bot-right x,y
  956. 0x0016 => { #2
  957. Name => 'ImageBoundary',
  958. Writable => 'int16u',
  959. Count => 4,
  960. },
  961. 0x0017 => { #28
  962. Name => 'ExternalFlashExposureComp', #PH (setting from external flash unit)
  963. Writable => 'undef',
  964. Count => 4,
  965. ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
  966. ValueConvInv => q{
  967. my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
  968. $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
  969. },
  970. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  971. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  972. },
  973. 0x0018 => { #5
  974. Name => 'FlashExposureBracketValue',
  975. Writable => 'undef',
  976. Count => 4,
  977. ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
  978. ValueConvInv => q{
  979. my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
  980. $a<-128 or $a>127 ? undef : pack("c4",$a,1,6,0);
  981. },
  982. PrintConv => 'sprintf("%.1f",$val)',
  983. PrintConvInv => '$val',
  984. },
  985. 0x0019 => { #5
  986. Name => 'ExposureBracketValue',
  987. Writable => 'rational64s',
  988. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  989. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  990. },
  991. 0x001a => { #PH
  992. Name => 'ImageProcessing',
  993. Writable => 'string',
  994. },
  995. 0x001b => { #15
  996. Name => 'CropHiSpeed',
  997. Writable => 'int16u',
  998. Count => 7,
  999. PrintConv => q{
  1000. my @a = split ' ', $val;
  1001. return "Unknown ($val)" unless @a == 7;
  1002. $a[0] = $a[0] ? "On" : "Off";
  1003. return "$a[0] ($a[1]x$a[2] cropped to $a[3]x$a[4] at pixel $a[5],$a[6])";
  1004. }
  1005. },
  1006. 0x001c => { #28 (D3 "the application of CSb6 to the selected metering mode")
  1007. Name => 'ExposureTuning',
  1008. Writable => 'undef',
  1009. Count => 3,
  1010. ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
  1011. ValueConvInv => q{
  1012. my $a = int($val*6 + ($val>0 ? 0.5 : -0.5));
  1013. $a<-128 or $a>127 ? undef : pack("c3",$a,1,6);
  1014. },
  1015. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  1016. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  1017. },
  1018. 0x001d => { #4
  1019. Name => 'SerialNumber',
  1020. # Note: this has been known to change even if the serial number on the body
  1021. # stays the same if some parts of the camera were replaced by Nikon service
  1022. Writable => 'string',
  1023. Protected => 1,
  1024. Notes => q{
  1025. this value is used as a key to decrypt other information -- writing this tag
  1026. causes the other information to be re-encrypted with the new key
  1027. },
  1028. PrintConv => undef, # disable default PRINT_CONV
  1029. },
  1030. 0x001e => { #14
  1031. Name => 'ColorSpace',
  1032. Writable => 'int16u',
  1033. PrintConv => {
  1034. 1 => 'sRGB',
  1035. 2 => 'Adobe RGB',
  1036. },
  1037. },
  1038. 0x001f => { #PH
  1039. Name => 'VRInfo',
  1040. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::VRInfo' },
  1041. },
  1042. 0x0020 => { #16
  1043. Name => 'ImageAuthentication',
  1044. Writable => 'int8u',
  1045. PrintConv => \%offOn,
  1046. },
  1047. 0x0021 => { #PH
  1048. Name => 'FaceDetect',
  1049. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FaceDetect' },
  1050. },
  1051. 0x0022 => { #21
  1052. Name => 'ActiveD-Lighting',
  1053. Writable => 'int16u',
  1054. PrintConv => {
  1055. 0 => 'Off',
  1056. 1 => 'Low',
  1057. 3 => 'Normal',
  1058. 5 => 'High',
  1059. 7 => 'Extra High', #10
  1060. 8 => 'Extra High 1', #PH
  1061. 9 => 'Extra High 2', #PH
  1062. 10 => 'Extra High 3', #PH
  1063. 11 => 'Extra High 4', #PH
  1064. 0xffff => 'Auto', #10
  1065. },
  1066. },
  1067. 0x0023 => { #PH (D300, but also found in D3,D3S,D3X,D90,D300S,D700,D3000,D5000)
  1068. Name => 'PictureControlData',
  1069. Writable => 'undef',
  1070. Permanent => 0,
  1071. Flags => [ 'Binary', 'Protected' ],
  1072. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
  1073. },
  1074. 0x0024 => { #JD
  1075. Name => 'WorldTime',
  1076. SubDirectory => {
  1077. TagTable => 'Image::ExifTool::Nikon::WorldTime',
  1078. # (CaptureNX does flip the byte order of this record)
  1079. },
  1080. },
  1081. 0x0025 => { #PH
  1082. Name => 'ISOInfo',
  1083. SubDirectory => {
  1084. TagTable => 'Image::ExifTool::Nikon::ISOInfo',
  1085. ByteOrder => 'BigEndian',
  1086. },
  1087. },
  1088. 0x002a => { #23 (this tag added with D3 firmware 1.10 -- also written by Nikon utilities)
  1089. Name => 'VignetteControl',
  1090. Writable => 'int16u',
  1091. PrintConv => {
  1092. 0 => 'Off',
  1093. 1 => 'Low',
  1094. 3 => 'Normal',
  1095. 5 => 'High',
  1096. },
  1097. },
  1098. 0x002b => { #PH
  1099. Name => 'DistortInfo',
  1100. SubDirectory => {
  1101. TagTable => 'Image::ExifTool::Nikon::DistortInfo',
  1102. ByteOrder => 'BigEndian', #(NC)
  1103. },
  1104. },
  1105. 0x002c => { #29 (D7000)
  1106. Name => 'UnknownInfo',
  1107. SubDirectory => {
  1108. TagTable => 'Image::ExifTool::Nikon::UnknownInfo',
  1109. ByteOrder => 'BigEndian', #(NC)
  1110. },
  1111. },
  1112. 0x0032 => { #PH
  1113. Name => 'UnknownInfo2',
  1114. SubDirectory => {
  1115. TagTable => 'Image::ExifTool::Nikon::UnknownInfo2',
  1116. ByteOrder => 'BigEndian', #(NC)
  1117. },
  1118. },
  1119. # 0x0034 - Nikon 1 models only, values: 0,16,33
  1120. 0x0035 => { #32
  1121. Name => 'HDRInfo',
  1122. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::HDRInfo' },
  1123. },
  1124. # 0x0037 - int32u (1V models only): an image count maybe? - PH
  1125. 0x0039 => {
  1126. Name => 'LocationInfo',
  1127. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LocationInfo' },
  1128. },
  1129. 0x003d => { #33
  1130. Name => 'BlackLevel',
  1131. Writable => 'int16u',
  1132. Count => 4,
  1133. # (may need to divide by 4 for some images, eg. D3300/D5300, 12 bit - ref 33)
  1134. },
  1135. 0x0080 => { Name => 'ImageAdjustment', Writable => 'string' },
  1136. 0x0081 => { Name => 'ToneComp', Writable => 'string' }, #2
  1137. 0x0082 => { Name => 'AuxiliaryLens', Writable => 'string' },
  1138. 0x0083 => {
  1139. Name => 'LensType',
  1140. Writable => 'int8u',
  1141. # credit to Tom Christiansen (ref 7) for figuring this out...
  1142. PrintConv => q[$_ = $val ? Image::ExifTool::DecodeBits($val,
  1143. {
  1144. 0 => 'MF',
  1145. 1 => 'D',
  1146. 2 => 'G',
  1147. 3 => 'VR',
  1148. # bit 4 set for Nikon 1 lenses - PH
  1149. # bit 5 set for FT-1 adapter? - PH
  1150. # bit 6 set for FL lenses? - PH
  1151. }) : 'AF';
  1152. # remove commas and change "D G" to just "G"
  1153. s/,//g; s/\bD G\b/G/; $_
  1154. ],
  1155. PrintConvInv => q[
  1156. my $bits = 0;
  1157. $bits |= 0x01 if $val =~ /\bMF\b/i;
  1158. $bits |= 0x02 if $val =~ /\bD\b/i;
  1159. $bits |= 0x06 if $val =~ /\bG\b/i;
  1160. $bits |= 0x08 if $val =~ /\bVR\b/i;
  1161. return $bits;
  1162. ],
  1163. },
  1164. 0x0084 => { #2
  1165. Name => "Lens",
  1166. Writable => 'rational64u',
  1167. Count => 4,
  1168. # short focal, long focal, aperture at short focal, aperture at long focal
  1169. PrintConv => \&Image::ExifTool::Exif::PrintLensInfo,
  1170. PrintConvInv => \&Image::ExifTool::Exif::ConvertLensInfo,
  1171. },
  1172. 0x0085 => {
  1173. Name => 'ManualFocusDistance',
  1174. Writable => 'rational64u',
  1175. },
  1176. 0x0086 => {
  1177. Name => 'DigitalZoom',
  1178. Writable => 'rational64u',
  1179. },
  1180. 0x0087 => { #5
  1181. Name => 'FlashMode',
  1182. Writable => 'int8u',
  1183. PrintConv => {
  1184. 0 => 'Did Not Fire',
  1185. 1 => 'Fired, Manual', #14
  1186. 3 => 'Not Ready', #28
  1187. 7 => 'Fired, External', #14
  1188. 8 => 'Fired, Commander Mode',
  1189. 9 => 'Fired, TTL Mode',
  1190. },
  1191. },
  1192. 0x0088 => [
  1193. {
  1194. Name => 'AFInfo',
  1195. Condition => '$$self{Model} =~ /^NIKON D/i',
  1196. SubDirectory => {
  1197. TagTable => 'Image::ExifTool::Nikon::AFInfo',
  1198. ByteOrder => 'BigEndian',
  1199. },
  1200. },
  1201. {
  1202. Name => 'AFInfo',
  1203. SubDirectory => {
  1204. TagTable => 'Image::ExifTool::Nikon::AFInfo',
  1205. ByteOrder => 'LittleEndian',
  1206. },
  1207. },
  1208. ],
  1209. 0x0089 => { #5
  1210. Name => 'ShootingMode',
  1211. Writable => 'int16u',
  1212. # the meaning of bit 5 seems to change: For the D200 it indicates "Auto ISO" - PH
  1213. Notes => 'for the D70, Bit 5 = Unused LE-NR Slowdown',
  1214. # credit to Tom Christiansen (ref 7) for figuring this out...
  1215. # The (new?) bit 5 seriously complicates our life here: after firmwareB's
  1216. # 1.03, bit 5 turns on when you ask for BUT DO NOT USE the long-range
  1217. # noise reduction feature, probably because even not using it, it still
  1218. # slows down your drive operation to 50% (1.5fps max not 3fps). But no
  1219. # longer does !$val alone indicate single-frame operation. - TC, D70
  1220. PrintConv => q[
  1221. $_ = '';
  1222. unless ($val & 0x87) {
  1223. return 'Single-Frame' unless $val;
  1224. $_ = 'Single-Frame, ';
  1225. }
  1226. return $_ . Image::ExifTool::DecodeBits($val,
  1227. {
  1228. 0 => 'Continuous',
  1229. 1 => 'Delay',
  1230. 2 => 'PC Control',
  1231. 3 => 'Self-timer', #forum6281 (NC)
  1232. 4 => 'Exposure Bracketing',
  1233. 5 => $$self{Model}=~/D70\b/ ? 'Unused LE-NR Slowdown' : 'Auto ISO',
  1234. 6 => 'White-Balance Bracketing',
  1235. 7 => 'IR Control',
  1236. 8 => 'D-Lighting Bracketing', #forum6281 (NC)
  1237. });
  1238. ],
  1239. },
  1240. # 0x008a - called "AutoBracketRelease" by ref 15 [but this seems wrong]
  1241. # values: 0,255 (when writing NEF only), or 1,2 (when writing JPEG or JPEG+NEF)
  1242. # --> makes odd, repeating pattern in sequential NEF images (ref 28)
  1243. 0x008b => { #8
  1244. Name => 'LensFStops',
  1245. ValueConv => 'my ($a,$b,$c)=unpack("C3",$val); $c ? $a*($b/$c) : 0',
  1246. ValueConvInv => 'my $a=int($val*12+0.5);$a<256 ? pack("C4",$a,1,12,0) : undef',
  1247. PrintConv => 'sprintf("%.2f", $val)',
  1248. PrintConvInv => '$val',
  1249. Writable => 'undef',
  1250. Count => 4,
  1251. },
  1252. 0x008c => {
  1253. Name => 'ContrastCurve', #JD
  1254. Writable => 'undef',
  1255. Flags => [ 'Binary', 'Protected' ],
  1256. },
  1257. # ColorHue: MODE1/MODE1a=sRGB, MODE2=Adobe RGB, MODE3a=more saturated sRGB
  1258. # --> should really be called ColorSpace or ColorMode, but that would conflict with other tags
  1259. 0x008d => { Name => 'ColorHue' , Writable => 'string' }, #2
  1260. # SceneMode takes on the following values: PORTRAIT, PARTY/INDOOR, NIGHT PORTRAIT,
  1261. # BEACH/SNOW, LANDSCAPE, SUNSET, NIGHT SCENE, MUSEUM, FIREWORKS, CLOSE UP, COPY,
  1262. # BACK LIGHT, PANORAMA ASSIST, SPORT, DAWN/DUSK
  1263. 0x008f => { Name => 'SceneMode', Writable => 'string' }, #2
  1264. # LightSource shows 3 values COLORED SPEEDLIGHT NATURAL.
  1265. # (SPEEDLIGHT when flash goes. Have no idea about difference between other two.)
  1266. 0x0090 => { Name => 'LightSource', Writable => 'string' }, #2
  1267. 0x0091 => [ #18
  1268. { #PH
  1269. Condition => '$$valPt =~ /^0209/',
  1270. Name => 'ShotInfoD40',
  1271. SubDirectory => {
  1272. TagTable => 'Image::ExifTool::Nikon::ShotInfoD40',
  1273. DecryptStart => 4,
  1274. DecryptLen => 748,
  1275. ByteOrder => 'BigEndian',
  1276. },
  1277. },
  1278. {
  1279. Condition => '$$valPt =~ /^0208/',
  1280. Name => 'ShotInfoD80',
  1281. SubDirectory => {
  1282. TagTable => 'Image::ExifTool::Nikon::ShotInfoD80',
  1283. DecryptStart => 4,
  1284. DecryptLen => 764,
  1285. # (Capture NX can change the makernote byte order, but this stays big-endian)
  1286. ByteOrder => 'BigEndian',
  1287. },
  1288. },
  1289. { #PH (D90, firmware 1.00)
  1290. Condition => '$$valPt =~ /^0213/',
  1291. Name => 'ShotInfoD90',
  1292. SubDirectory => {
  1293. TagTable => 'Image::ExifTool::Nikon::ShotInfoD90',
  1294. DecryptStart => 4,
  1295. DecryptLen => 0x398,
  1296. ByteOrder => 'BigEndian',
  1297. },
  1298. },
  1299. { #PH (D3, firmware 0.37 and 1.00)
  1300. Condition => '$$valPt =~ /^0210/ and $count == 5399',
  1301. Name => 'ShotInfoD3a',
  1302. SubDirectory => {
  1303. TagTable => 'Image::ExifTool::Nikon::ShotInfoD3a',
  1304. DecryptStart => 4,
  1305. DecryptLen => 0x318,
  1306. ByteOrder => 'BigEndian',
  1307. },
  1308. },
  1309. { #PH (D3, firmware 1.10, 2.00 and 2.01 [count 5408], and 2.02 [count 5412])
  1310. Condition => '$$valPt =~ /^0210/ and ($count == 5408 or $count == 5412)',
  1311. Name => 'ShotInfoD3b',
  1312. SubDirectory => {
  1313. TagTable => 'Image::ExifTool::Nikon::ShotInfoD3b',
  1314. DecryptStart => 4,
  1315. DecryptLen => 0x321,
  1316. ByteOrder => 'BigEndian',
  1317. },
  1318. },
  1319. { #PH (D3X, firmware 1.00)
  1320. Condition => '$$valPt =~ /^0214/ and $count == 5409',
  1321. Name => 'ShotInfoD3X',
  1322. SubDirectory => {
  1323. TagTable => 'Image::ExifTool::Nikon::ShotInfoD3X',
  1324. DecryptStart => 4,
  1325. DecryptLen => 0x323,
  1326. ByteOrder => 'BigEndian',
  1327. },
  1328. },
  1329. { #PH (D3S, firmware 0.16 and 1.00)
  1330. Condition => '$$valPt =~ /^0218/ and ($count == 5356 or $count == 5388)',
  1331. Name => 'ShotInfoD3S',
  1332. SubDirectory => {
  1333. TagTable => 'Image::ExifTool::Nikon::ShotInfoD3S',
  1334. DecryptStart => 4,
  1335. DecryptLen => 0x2e9,
  1336. ByteOrder => 'BigEndian',
  1337. },
  1338. },
  1339. { #JD (D300, firmware 0.25 and 1.00)
  1340. # D3 and D300 use the same version number, but the length is different
  1341. Condition => '$$valPt =~ /^0210/ and $count == 5291',
  1342. Name => 'ShotInfoD300a',
  1343. SubDirectory => {
  1344. TagTable => 'Image::ExifTool::Nikon::ShotInfoD300a',
  1345. DecryptStart => 4,
  1346. DecryptLen => 813,
  1347. ByteOrder => 'BigEndian',
  1348. },
  1349. },
  1350. { #PH (D300, firmware version 1.10)
  1351. # yet again the same ShotInfoVersion for different data
  1352. Condition => '$$valPt =~ /^0210/ and $count == 5303',
  1353. Name => 'ShotInfoD300b',
  1354. SubDirectory => {
  1355. TagTable => 'Image::ExifTool::Nikon::ShotInfoD300b',
  1356. DecryptStart => 4,
  1357. DecryptLen => 825,
  1358. ByteOrder => 'BigEndian',
  1359. },
  1360. },
  1361. { #PH (D300S, firmware version 1.00)
  1362. # yet again the same ShotInfoVersion for different data
  1363. Condition => '$$valPt =~ /^0216/ and $count == 5311',
  1364. Name => 'ShotInfoD300S',
  1365. SubDirectory => {
  1366. TagTable => 'Image::ExifTool::Nikon::ShotInfoD300S',
  1367. DecryptStart => 4,
  1368. DecryptLen => 827,
  1369. ByteOrder => 'BigEndian',
  1370. },
  1371. },
  1372. # 0225 - D600
  1373. { #29 (D700 firmware version 1.02f)
  1374. Condition => '$$valPt =~ /^0212/ and $count == 5312',
  1375. Name => 'ShotInfoD700',
  1376. SubDirectory => {
  1377. TagTable => 'Image::ExifTool::Nikon::ShotInfoD700',
  1378. DecryptStart => 4,
  1379. DecryptLen => 0x358,
  1380. ByteOrder => 'BigEndian',
  1381. },
  1382. },
  1383. { #PH (D800 firmware 1.01a)
  1384. Condition => '$$valPt =~ /^0222/',
  1385. Name => 'ShotInfoD800',
  1386. SubDirectory => {
  1387. TagTable => 'Image::ExifTool::Nikon::ShotInfoD800',
  1388. DecryptStart => 4,
  1389. DecryptLen => 0x720,
  1390. ByteOrder => 'BigEndian',
  1391. },
  1392. },
  1393. { #28 (D810 firmware 1.01)
  1394. Condition => '$$valPt =~ /^0233/',
  1395. Name => 'ShotInfoD810',
  1396. SubDirectory => {
  1397. TagTable => 'Image::ExifTool::Nikon::ShotInfoD810',
  1398. DecryptStart => 4,
  1399. # initially only decrypt enough to extract CustomSettingsOffset
  1400. DecryptLen => 0x40,
  1401. # then decrypt through to the end of the custom settings
  1402. DecryptMore => 'Get32u(\$data, 0x40) + 53 + 4',
  1403. ByteOrder => 'LittleEndian',
  1404. },
  1405. },
  1406. # 0217 - D3000
  1407. # 0219 - D3100
  1408. # 0224 - D3200
  1409. { #PH
  1410. Condition => '$$valPt =~ /^0215/ and $count == 6745',
  1411. Name => 'ShotInfoD5000',
  1412. SubDirectory => {
  1413. TagTable => 'Image::ExifTool::Nikon::ShotInfoD5000',
  1414. DecryptStart => 4,
  1415. DecryptLen => 0x39a,
  1416. ByteOrder => 'BigEndian',
  1417. },
  1418. },
  1419. { #PH
  1420. Condition => '$$valPt =~ /^0221/ and $count == 8902',
  1421. Name => 'ShotInfoD5100',
  1422. SubDirectory => {
  1423. TagTable => 'Image::ExifTool::Nikon::ShotInfoD5100',
  1424. DecryptStart => 4,
  1425. DecryptLen => 0x430,
  1426. ByteOrder => 'BigEndian',
  1427. },
  1428. },
  1429. { #PH
  1430. Condition => '$$valPt =~ /^0226/ and $count == 11587',
  1431. Name => 'ShotInfoD5200',
  1432. SubDirectory => {
  1433. TagTable => 'Image::ExifTool::Nikon::ShotInfoD5200',
  1434. DecryptStart => 4,
  1435. DecryptLen => 0xd00,
  1436. ByteOrder => 'BigEndian',
  1437. },
  1438. },
  1439. { #29 (D7000 firmware version 1.01b)
  1440. Condition => '$$valPt =~ /^0220/',
  1441. Name => 'ShotInfoD7000',
  1442. SubDirectory => {
  1443. TagTable => 'Image::ExifTool::Nikon::ShotInfoD7000',
  1444. DecryptStart => 4,
  1445. DecryptLen => 0x448,
  1446. ByteOrder => 'BigEndian',
  1447. },
  1448. },
  1449. { # (D4 firmware version 1.00g)
  1450. Condition => '$$valPt =~ /^0223/',
  1451. Name => 'ShotInfoD4',
  1452. SubDirectory => {
  1453. TagTable => 'Image::ExifTool::Nikon::ShotInfoD4',
  1454. DecryptStart => 4,
  1455. DecryptLen => 0x789,
  1456. ByteOrder => 'BigEndian',
  1457. },
  1458. },
  1459. { # (D4S firmware version 1.00d and 1.01a)
  1460. Condition => '$$valPt =~ /^0231/',
  1461. Name => 'ShotInfoD4S',
  1462. SubDirectory => {
  1463. TagTable => 'Image::ExifTool::Nikon::ShotInfoD4S',
  1464. DecryptStart => 4,
  1465. DecryptLen => 0x3517,
  1466. ByteOrder => 'LittleEndian',
  1467. },
  1468. },
  1469. # 0227 - D7100
  1470. {
  1471. Condition => '$$valPt =~ /^02/',
  1472. Name => 'ShotInfo02xx',
  1473. SubDirectory => {
  1474. TagTable => 'Image::ExifTool::Nikon::ShotInfo',
  1475. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1476. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1477. DecryptStart => 4,
  1478. DecryptLen => 0x251,
  1479. ByteOrder => 'BigEndian',
  1480. },
  1481. },
  1482. {
  1483. Name => 'ShotInfoUnknown',
  1484. Writable => 0,
  1485. SubDirectory => {
  1486. TagTable => 'Image::ExifTool::Nikon::ShotInfo',
  1487. ByteOrder => 'BigEndian',
  1488. },
  1489. },
  1490. ],
  1491. 0x0092 => { #2
  1492. Name => 'HueAdjustment',
  1493. Writable => 'int16s',
  1494. },
  1495. # 0x0093 - ref 15 calls this Saturation, but this is wrong - PH
  1496. 0x0093 => { #21
  1497. Name => 'NEFCompression',
  1498. Writable => 'int16u',
  1499. PrintConv => {
  1500. 1 => 'Lossy (type 1)', # (older models)
  1501. 2 => 'Uncompressed', #JD - D100 (even though TIFF compression is set!)
  1502. 3 => 'Lossless',
  1503. 4 => 'Lossy (type 2)',
  1504. 6 => 'Uncompressed (reduced to 12 bit)', #33
  1505. 8 => 'Small', #33
  1506. },
  1507. },
  1508. 0x0094 => { Name => 'Saturation', Writable => 'int16s' },
  1509. 0x0095 => { Name => 'NoiseReduction', Writable => 'string' }, # (long exposure NR)
  1510. 0x0096 => {
  1511. Name => 'NEFLinearizationTable', # same table as DNG LinearizationTable (ref JD)
  1512. Writable => 'undef',
  1513. Flags => [ 'Binary', 'Protected' ],
  1514. },
  1515. 0x0097 => [ #4
  1516. # (NOTE: these are byte-swapped by NX when byte order changes)
  1517. {
  1518. Condition => '$$valPt =~ /^0100/', # (D100 and Coolpix models)
  1519. Name => 'ColorBalance0100',
  1520. SubDirectory => {
  1521. Start => '$valuePtr + 72',
  1522. TagTable => 'Image::ExifTool::Nikon::ColorBalance1',
  1523. },
  1524. },
  1525. {
  1526. Condition => '$$valPt =~ /^0102/', # (D2H)
  1527. Name => 'ColorBalance0102',
  1528. SubDirectory => {
  1529. Start => '$valuePtr + 10',
  1530. TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
  1531. },
  1532. },
  1533. {
  1534. Condition => '$$valPt =~ /^0103/', # (D70/D70s)
  1535. Name => 'ColorBalance0103',
  1536. # D70: at file offset 'tag-value + base + 20', 4 16 bits numbers,
  1537. # v[0]/v[1] , v[2]/v[3] are the red/blue multipliers.
  1538. SubDirectory => {
  1539. Start => '$valuePtr + 20',
  1540. TagTable => 'Image::ExifTool::Nikon::ColorBalance3',
  1541. },
  1542. },
  1543. {
  1544. Condition => '$$valPt =~ /^0205/', # (D50)
  1545. Name => 'ColorBalance0205',
  1546. SubDirectory => {
  1547. TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
  1548. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1549. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1550. DecryptStart => 4,
  1551. DecryptLen => 22, # 284 bytes encrypted, but don't need to decrypt it all
  1552. DirOffset => 14,
  1553. },
  1554. },
  1555. { # (D3/D3X/D300/D700=0209,D300S=0212,D3S=0214)
  1556. Condition => '$$valPt =~ /^02(09|12|14)/',
  1557. Name => 'ColorBalance0209',
  1558. SubDirectory => {
  1559. TagTable => 'Image::ExifTool::Nikon::ColorBalance4',
  1560. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1561. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1562. DecryptStart => 284,
  1563. DecryptLen => 18, # 324 bytes encrypted, but don't need to decrypt it all
  1564. DirOffset => 10,
  1565. },
  1566. },
  1567. { # (D2X/D2Xs=0204,D2Hs=0206,D200=0207,D40/D40X/D80=0208,D60=0210)
  1568. Condition => '$$valPt =~ /^02(\d{2})/ and $1 < 11',
  1569. Name => 'ColorBalance02',
  1570. SubDirectory => {
  1571. TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
  1572. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1573. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1574. DecryptStart => 284,
  1575. DecryptLen => 14, # don't need to decrypt it all
  1576. DirOffset => 6,
  1577. },
  1578. },
  1579. {
  1580. Condition => '$$valPt =~ /^0211/', # (D90/D5000)
  1581. Name => 'ColorBalance0211',
  1582. SubDirectory => {
  1583. TagTable => 'Image::ExifTool::Nikon::ColorBalance4',
  1584. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1585. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1586. DecryptStart => 284,
  1587. DecryptLen => 24, # don't need to decrypt it all
  1588. DirOffset => 16,
  1589. },
  1590. },
  1591. {
  1592. Condition => '$$valPt =~ /^0213/', # (D3000)
  1593. Name => 'ColorBalance0213',
  1594. SubDirectory => {
  1595. TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
  1596. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1597. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1598. DecryptStart => 284,
  1599. DecryptLen => 18, # don't need to decrypt it all
  1600. DirOffset => 10,
  1601. },
  1602. },
  1603. { # (D3100=0215,D7000/D5100=0216,D4/D800/D3200=0217)
  1604. Condition => '$$valPt =~ /^021[567]/',
  1605. Name => 'ColorBalance0215',
  1606. SubDirectory => {
  1607. TagTable => 'Image::ExifTool::Nikon::ColorBalance4',
  1608. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1609. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1610. DecryptStart => 284,
  1611. DecryptLen => 12, # don't need to decrypt it all
  1612. DirOffset => 4,
  1613. },
  1614. },
  1615. { # (D5200/D7100=0218, D5300=0219, D610/Df=0220, D3300=0221, CoolpixA=0601)
  1616. Name => 'ColorBalanceUnknown02',
  1617. Condition => '$$valPt =~ /^0[26]/',
  1618. SubDirectory => {
  1619. TagTable => 'Image::ExifTool::Nikon::ColorBalanceUnknown',
  1620. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1621. DecryptStart => 284,
  1622. DecryptLen => 10, # (arbitrary)
  1623. },
  1624. },
  1625. { # (1J1/1J2/1V1=0400, 1V2=0401, 1J3/1S1=0402, 1AW1=0403)
  1626. Name => 'ColorBalanceUnknown04',
  1627. Condition => '$$valPt =~ /^04/',
  1628. SubDirectory => {
  1629. TagTable => 'Image::ExifTool::Nikon::ColorBalanceUnknown',
  1630. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1631. DecryptStart => 4,
  1632. DecryptLen => 10, # (arbitrary)
  1633. },
  1634. },
  1635. {
  1636. # (CoolpixP7700/P7800=0500, CoolpixP330/P520=0502)
  1637. Name => 'ColorBalanceUnknown',
  1638. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::ColorBalanceUnknown' },
  1639. },
  1640. ],
  1641. 0x0098 => [
  1642. { #8
  1643. Condition => '$$valPt =~ /^0100/', # D100, D1X - PH
  1644. Name => 'LensData0100',
  1645. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LensData00' },
  1646. },
  1647. { #8
  1648. Condition => '$$valPt =~ /^0101/', # D70, D70s - PH
  1649. Name => 'LensData0101',
  1650. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LensData01' },
  1651. },
  1652. # note: this information is encrypted if the version is 02xx
  1653. { #8
  1654. # 0201 - D200, D2Hs, D2X and D2Xs
  1655. # 0202 - D40, D40X and D80
  1656. # 0203 - D300
  1657. Condition => '$$valPt =~ /^020[1-3]/',
  1658. Name => 'LensData0201',
  1659. SubDirectory => {
  1660. TagTable => 'Image::ExifTool::Nikon::LensData01',
  1661. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1662. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1663. DecryptStart => 4,
  1664. },
  1665. },
  1666. { #PH
  1667. Condition => '$$valPt =~ /^0204/', # D90, D7000
  1668. Name => 'LensData0204',
  1669. SubDirectory => {
  1670. TagTable => 'Image::ExifTool::Nikon::LensData0204',
  1671. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1672. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1673. DecryptStart => 4,
  1674. },
  1675. },
  1676. {
  1677. Condition => '$$valPt =~ /^0400/', # 1J1, 1V1
  1678. Name => 'LensData0400',
  1679. SubDirectory => {
  1680. TagTable => 'Image::ExifTool::Nikon::LensData0400',
  1681. ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1682. WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  1683. DecryptStart => 4,
  1684. },
  1685. },
  1686. { # (1J1/1V1=0400)
  1687. Name => 'LensDataUnknown',
  1688. SubDirectory => {
  1689. TagTable => 'Image::ExifTool::Nikon::LensDataUnknown',
  1690. },
  1691. },
  1692. ],
  1693. 0x0099 => { #2/15
  1694. Name => 'RawImageCenter',
  1695. Writable => 'int16u',
  1696. Count => 2,
  1697. },
  1698. 0x009a => { #10
  1699. Name => 'SensorPixelSize',
  1700. Writable => 'rational64u',
  1701. Count => 2,
  1702. PrintConv => '$val=~s/ / x /;"$val um"',
  1703. PrintConvInv => '$val=~tr/a-zA-Z/ /;$val',
  1704. },
  1705. 0x009c => { #14
  1706. # L2/L3 has these modes (from owner's manual): - PH
  1707. # Portrait Assist: FACE-PRIORITY AF,PORTRAIT,PORTRAIT LEFT,PORTRAIT RIGHT,
  1708. # PORTRAIT CLOSE-UP,PORTRAIT COUPLE,PORTRAIT-FIGURE
  1709. # Landscape Assist:LANDSCAPE,SCENIC VIEW,ARCHITECTURE,GROUP RIGHT,GROUP LEFT
  1710. # Sports Assist: SPORTS,SPORT SPECTATOR,SPORT COMPOSITE
  1711. # P7100 has test modes: - PH
  1712. # CREATIVE MONOCHROME,PAINTING,CROSS PROCESS,SOFT,NOSTALGIC SEPIA,
  1713. # HIGH KEY,LOW KEY,SELECTIVE COLOR,ZOOM EXPOSURE EXP.,DEFOCUS DURING
  1714. Name => 'SceneAssist',
  1715. Writable => 'string',
  1716. },
  1717. 0x009e => { #JD
  1718. Name => 'RetouchHistory',
  1719. Writable => 'int16u',
  1720. Count => 10,
  1721. # trim off extra "None" values
  1722. ValueConv => '$val=~s/( 0)+$//; $val',
  1723. ValueConvInv => 'my $n=($val=~/ \d+/g);$n < 9 ? $val . " 0" x (9-$n) : $val',
  1724. PrintConvColumns => 2,
  1725. PrintConv => [
  1726. \%retouchValues,
  1727. \%retouchValues,
  1728. \%retouchValues,
  1729. \%retouchValues,
  1730. \%retouchValues,
  1731. \%retouchValues,
  1732. \%retouchValues,
  1733. \%retouchValues,
  1734. \%retouchValues,
  1735. \%retouchValues,
  1736. ],
  1737. },
  1738. 0x00a0 => { Name => 'SerialNumber', Writable => 'string' }, #2
  1739. 0x00a2 => { # size of compressed image data plus EOI segment (ref 10)
  1740. Name => 'ImageDataSize',
  1741. Writable => 'int32u',
  1742. },
  1743. # 0x00a3 - int8u: 0 (All DSLR's but D1,D1H,D1X,D100)
  1744. # 0x00a4 - version number found only in NEF images from DSLR models except the
  1745. # D1,D1X,D2H and D100. Value is "0200" for all available samples except images
  1746. # edited by Nikon Capture Editor 4.3.1 W and 4.4.2 which have "0100" - PH
  1747. 0x00a5 => { #15
  1748. Name => 'ImageCount',
  1749. Writable => 'int32u',
  1750. },
  1751. 0x00a6 => { #15
  1752. Name => 'DeletedImageCount',
  1753. Writable => 'int32u',
  1754. },
  1755. # the sum of 0xa5 and 0xa6 is equal to 0xa7 ShutterCount (D2X,D2Hs,D2H,D200, ref 10)
  1756. 0x00a7 => { # Number of shots taken by camera so far (ref 2)
  1757. Name => 'ShutterCount',
  1758. Writable => 'int32u',
  1759. Protected => 1,
  1760. Notes => q{
  1761. this value is used as a key to decrypt other information -- writing this tag
  1762. causes the other information to be re-encrypted with the new key
  1763. },
  1764. },
  1765. 0x00a8 => [#JD
  1766. {
  1767. Name => 'FlashInfo0100',
  1768. Condition => '$$valPt =~ /^010[01]/',
  1769. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0100' },
  1770. },
  1771. {
  1772. Name => 'FlashInfo0102',
  1773. Condition => '$$valPt =~ /^0102/',
  1774. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0102' },
  1775. },
  1776. {
  1777. Name => 'FlashInfo0103',
  1778. # (0104 for D7000, 0105 for D800)
  1779. Condition => '$$valPt =~ /^010[345]/',
  1780. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0103' },
  1781. },
  1782. {
  1783. Name => 'FlashInfoUnknown',
  1784. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfoUnknown' },
  1785. },
  1786. ],
  1787. 0x00a9 => { Name => 'ImageOptimization',Writable => 'string' },#2
  1788. 0x00aa => { Name => 'Saturation', Writable => 'string' }, #2
  1789. 0x00ab => { Name => 'VariProgram', Writable => 'string' }, #2 (scene mode for DSLR's - PH)
  1790. 0x00ac => { Name => 'ImageStabilization',Writable=> 'string' }, #14
  1791. 0x00ad => { Name => 'AFResponse', Writable => 'string' }, #14
  1792. 0x00b0 => { #PH
  1793. Name => 'MultiExposure',
  1794. Condition => '$$valPt =~ /^0100/',
  1795. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::MultiExposure' },
  1796. },
  1797. 0x00b1 => { #14/PH/JD (D80)
  1798. Name => 'HighISONoiseReduction',
  1799. Writable => 'int16u',
  1800. PrintConv => {
  1801. 0 => 'Off',
  1802. 1 => 'Minimal', # for high ISO (>800) when setting is "Off"
  1803. 2 => 'Low', # Low,Normal,High take effect for ISO > 400
  1804. 3 => 'Medium Low',
  1805. 4 => 'Normal',
  1806. 5 => 'Medium High',
  1807. 6 => 'High',
  1808. },
  1809. },
  1810. # 0x00b2 (string: "NORMAL ", 0xc3's, 0xff's or 0x20's)
  1811. 0x00b3 => { #14
  1812. Name => 'ToningEffect',
  1813. Writable => 'string',
  1814. },
  1815. 0x00b6 => { #PH
  1816. Name => 'PowerUpTime',
  1817. Groups => { 2 => 'Time' },
  1818. Shift => 'Time',
  1819. # not clear whether "powered up" means "turned on" or "power applied" - PH
  1820. Notes => 'date/time when camera was last powered up',
  1821. Writable => 'undef',
  1822. # must use RawConv so byte order is correct
  1823. RawConv => sub {
  1824. my $val = shift;
  1825. return $val if length $val < 7;
  1826. my $shrt = GetByteOrder() eq 'II' ? 'v' : 'n';
  1827. my @date = unpack("${shrt}C5", $val);
  1828. return sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @date);
  1829. },
  1830. RawConvInv => sub {
  1831. my $val = shift;
  1832. my $shrt = GetByteOrder() eq 'II' ? 'v' : 'n';
  1833. my @date = ($val =~ /\d+/g);
  1834. return pack("${shrt}C6", @date, 0);
  1835. },
  1836. PrintConv => '$self->ConvertDateTime($val)',
  1837. PrintConvInv => '$self->InverseDateTime($val,0)',
  1838. },
  1839. 0x00b7 => { #JD
  1840. Name => 'AFInfo2',
  1841. # (this structure may be byte swapped when rewritten by CaptureNX)
  1842. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2' },
  1843. },
  1844. 0x00b8 => [{ #PH
  1845. Name => 'FileInfo',
  1846. # unfortunately, some newer models write this as little-endian
  1847. # (and CaptureNX can change the byte order of the maker notes,
  1848. # but leaves this structure unchanged)
  1849. # - it will be an ongoing pain to keep this list of models up-to-date,
  1850. # so if only one ordering yields valid DirectoryNumber and FileNumber values,
  1851. # use it, otherwise default to a-priori knowledge of the camera model
  1852. # (assume that a valid DirectoryNumber is 100-999, and a valid FileNumber
  1853. # is 0000-9999, although I have some samples with a DirectoryNumber of 99)
  1854. Condition => q{
  1855. if (length($$valPt) >= 0) {
  1856. my ($dir, $file) = unpack('x6vv', $$valPt);
  1857. my $littleEndian = ($dir >= 100 and $dir <= 999 and $file <= 9999);
  1858. ($dir, $file) = unpack('x6nn', $$valPt);
  1859. my $bigEndian = ($dir >= 100 and $dir <= 999 and $file <= 9999);
  1860. return $littleEndian if $littleEndian xor $bigEndian;
  1861. }
  1862. return $$self{Model} =~ /^NIKON (D4S|D750|D810|D3300|D5200|D5300|D5500|D7100)$/;
  1863. },
  1864. SubDirectory => {
  1865. TagTable => 'Image::ExifTool::Nikon::FileInfo',
  1866. ByteOrder => 'LittleEndian',
  1867. },
  1868. },{
  1869. Name => 'FileInfo',
  1870. SubDirectory => {
  1871. TagTable => 'Image::ExifTool::Nikon::FileInfo',
  1872. ByteOrder => 'BigEndian',
  1873. },
  1874. }],
  1875. 0x00b9 => { #28
  1876. Name => 'AFTune',
  1877. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFTune' },
  1878. },
  1879. # 0x00ba - custom curve data? (ref 28?) (only in NEF images)
  1880. 0x00bb => { #forum6281
  1881. Name => 'RetouchInfo',
  1882. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::RetouchInfo' },
  1883. },
  1884. # 0x00bc - NEFThumbnail? (forum6281)
  1885. 0x00bd => { #PH (P6000)
  1886. Name => 'PictureControlData',
  1887. Writable => 'undef',
  1888. Permanent => 0,
  1889. Flags => [ 'Binary', 'Protected' ],
  1890. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
  1891. },
  1892. 0x00c3 => {
  1893. Name => 'BarometerInfo',
  1894. SubDirectory => {
  1895. TagTable => 'Image::ExifTool::Nikon::BarometerInfo',
  1896. ByteOrder => 'LittleEndian',
  1897. },
  1898. },
  1899. 0x0e00 => {
  1900. Name => 'PrintIM',
  1901. Description => 'Print Image Matching',
  1902. Writable => 0,
  1903. SubDirectory => {
  1904. TagTable => 'Image::ExifTool::PrintIM::Main',
  1905. },
  1906. },
  1907. # 0x0e01 - In D70 NEF files produced by Nikon Capture, the data for this tag extends 4 bytes
  1908. # past the end of the maker notes. Very odd. I hope these 4 bytes aren't useful because
  1909. # they will get lost by any utility that blindly copies the maker notes (not ExifTool) - PH
  1910. 0x0e01 => {
  1911. Name => 'NikonCaptureData',
  1912. Writable => 'undef',
  1913. Permanent => 0,
  1914. # (Drop because may be too large for JPEG images)
  1915. Flags => [ 'Binary', 'Protected', 'Drop' ],
  1916. Notes => q{
  1917. this data is dropped when copying Nikon MakerNotes since it may be too large
  1918. to fit in the EXIF segment of a JPEG image, but it may be copied as a block
  1919. into existing Nikon MakerNotes later if desired
  1920. },
  1921. SubDirectory => {
  1922. DirName => 'NikonCapture',
  1923. TagTable => 'Image::ExifTool::NikonCapture::Main',
  1924. },
  1925. },
  1926. # 0x0e05 written by Nikon Capture to NEF files, values of 1 and 2 - PH
  1927. 0x0e09 => { #12
  1928. Name => 'NikonCaptureVersion',
  1929. Writable => 'string',
  1930. PrintConv => undef,
  1931. },
  1932. # 0x0e0e is in D70 Nikon Capture files (not out-of-the-camera D70 files) - PH
  1933. 0x0e0e => { #PH
  1934. Name => 'NikonCaptureOffsets',
  1935. SubDirectory => {
  1936. TagTable => 'Image::ExifTool::Nikon::CaptureOffsets',
  1937. Validate => '$val =~ /^0100/',
  1938. Start => '$valuePtr + 4',
  1939. },
  1940. },
  1941. 0x0e10 => { #17
  1942. Name => 'NikonScanIFD',
  1943. Groups => { 1 => 'NikonScan', 2 => 'Image' },
  1944. Flags => 'SubIFD',
  1945. SubDirectory => {
  1946. TagTable => 'Image::ExifTool::Nikon::Scan',
  1947. Start => '$val',
  1948. },
  1949. },
  1950. 0x0e13 => [{ # PH/http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2737.0.html
  1951. Name => 'NikonCaptureEditVersions',
  1952. Condition => '$self->Options("ExtractEmbedded")',
  1953. Notes => q{
  1954. the ExtractEmbedded option may be used to decode settings from the stored
  1955. edit versions, otherwise this is extracted as a binary data block
  1956. },
  1957. Writable => 'undef',
  1958. Permanent => 0,
  1959. Drop => 1, # (may be too large for JPEG images)
  1960. SubDirectory => {
  1961. DirName => 'NikonCaptureEditVersions',
  1962. TagTable => 'Image::ExifTool::NikonCapture::Main',
  1963. ProcessProc => \&ProcessNikonCaptureEditVersions,
  1964. WriteProc => sub { return undef }, # (writing not yet supported)
  1965. },
  1966. },{
  1967. Name => 'NikonCaptureEditVersions',
  1968. Writable => 'undef',
  1969. Permanent => 0,
  1970. Flags => [ 'Binary', 'Protected', 'Drop' ],
  1971. }],
  1972. 0x0e1d => { #JD
  1973. Name => 'NikonICCProfile',
  1974. Flags => [ 'Binary', 'Protected' ],
  1975. Writable => 'undef', # must be defined here so tag will be extracted if specified
  1976. WriteCheck => q{
  1977. require Image::ExifTool::ICC_Profile;
  1978. return Image::ExifTool::ICC_Profile::ValidateICC(\$val);
  1979. },
  1980. SubDirectory => {
  1981. DirName => 'NikonICCProfile',
  1982. TagTable => 'Image::ExifTool::ICC_Profile::Main',
  1983. },
  1984. },
  1985. 0x0e1e => { #PH
  1986. Name => 'NikonCaptureOutput',
  1987. Writable => 'undef',
  1988. Permanent => 0,
  1989. Flags => [ 'Binary', 'Protected' ],
  1990. SubDirectory => {
  1991. TagTable => 'Image::ExifTool::Nikon::CaptureOutput',
  1992. Validate => '$val =~ /^0100/',
  1993. },
  1994. },
  1995. 0x0e22 => { #28
  1996. Name => 'NEFBitDepth',
  1997. Writable => 'int16u',
  1998. Count => 4,
  1999. Protected => 1,
  2000. PrintConv => {
  2001. '0 0 0 0' => 'n/a (JPEG)',
  2002. '8 8 8 0' => '8 x 3', # TIFF RGB
  2003. '16 16 16 0' => '16 x 3', # TIFF 16-bit RGB
  2004. '12 0 0 0' => 12,
  2005. '14 0 0 0' => 14,
  2006. },
  2007. },
  2008. );
  2009. # NikonScan IFD entries (ref 17)
  2010. %Image::ExifTool::Nikon::Scan = (
  2011. WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
  2012. CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
  2013. WRITE_GROUP => 'NikonScan',
  2014. WRITABLE => 1,
  2015. GROUPS => { 0 => 'MakerNotes', 1 => 'NikonScan', 2 => 'Image' },
  2016. VARS => { MINOR_ERRORS => 1 }, # this IFD is non-essential and often corrupted
  2017. NOTES => 'This information is written by the Nikon Scan software.',
  2018. 0x02 => { Name => 'FilmType', Writable => 'string', },
  2019. 0x40 => { Name => 'MultiSample', Writable => 'string' },
  2020. 0x41 => { Name => 'BitDepth', Writable => 'int16u' },
  2021. 0x50 => {
  2022. Name => 'MasterGain',
  2023. Writable => 'rational64s',
  2024. PrintConv => 'sprintf("%.2f",$val)',
  2025. PrintConvInv => '$val',
  2026. },
  2027. 0x51 => {
  2028. Name => 'ColorGain',
  2029. Writable => 'rational64s',
  2030. Count => 3,
  2031. PrintConv => 'sprintf("%.2f %.2f %.2f",split(" ",$val))',
  2032. PrintConvInv => '$val',
  2033. },
  2034. 0x60 => {
  2035. Name => 'ScanImageEnhancer',
  2036. Writable => 'int32u',
  2037. PrintConv => \%offOn,
  2038. },
  2039. 0x100 => { Name => 'DigitalICE', Writable => 'string' },
  2040. 0x110 => {
  2041. Name => 'ROCInfo',
  2042. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::ROC' },
  2043. },
  2044. 0x120 => {
  2045. Name => 'GEMInfo',
  2046. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::GEM' },
  2047. },
  2048. 0x200 => { Name => 'DigitalDEEShadowAdj', Writable => 'int32u' },
  2049. 0x201 => { Name => 'DigitalDEEThreshold', Writable => 'int32u' },
  2050. 0x202 => { Name => 'DigitalDEEHighlightAdj',Writable => 'int32u' },
  2051. );
  2052. # ref 17
  2053. %Image::ExifTool::Nikon::ROC = (
  2054. %binaryDataAttrs,
  2055. FORMAT => 'int32u',
  2056. GROUPS => { 0 => 'MakerNotes', 1 => 'NikonScan', 2 => 'Image' },
  2057. 0 => {
  2058. Name => 'DigitalROC',
  2059. ValueConv => '$val / 10',
  2060. ValueConvInv => 'int($val * 10)',
  2061. },
  2062. );
  2063. # ref 17
  2064. %Image::ExifTool::Nikon::GEM = (
  2065. %binaryDataAttrs,
  2066. FORMAT => 'int32u',
  2067. GROUPS => { 0 => 'MakerNotes', 1 => 'NikonScan', 2 => 'Image' },
  2068. 0 => {
  2069. Name => 'DigitalGEM',
  2070. ValueConv => '$val<95 ? $val/20-1 : 4',
  2071. ValueConvInv => '$val == 4 ? 95 : int(($val + 1) * 20)',
  2072. },
  2073. );
  2074. # Vibration Reduction information - PH (D300)
  2075. %Image::ExifTool::Nikon::VRInfo = (
  2076. %binaryDataAttrs,
  2077. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2078. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  2079. 0 => {
  2080. Name => 'VRInfoVersion',
  2081. Format => 'undef[4]',
  2082. Writable => 0,
  2083. },
  2084. 4 => {
  2085. Name => 'VibrationReduction',
  2086. PrintConv => {
  2087. 0 => 'n/a', # (1V1 with a non-VR lens)
  2088. 1 => 'On',
  2089. 2 => 'Off',
  2090. },
  2091. },
  2092. # 5 - values: 0, 1 (VR On), 2 (VR Off)
  2093. 6 => {
  2094. Name => 'VRMode',
  2095. PrintConv => {
  2096. 0 => 'Normal',
  2097. # 1 - seen this for 1V1 - PH
  2098. 2 => 'Active', # (1J1)
  2099. },
  2100. },
  2101. # 7 - values: 0, 1
  2102. );
  2103. # Face detection information - PH (S8100)
  2104. %Image::ExifTool::Nikon::FaceDetect = (
  2105. %binaryDataAttrs,
  2106. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  2107. FORMAT => 'int16u',
  2108. DATAMEMBER => [ 0x03 ],
  2109. 0x01 => {
  2110. Name => 'FaceDetectFrameSize',
  2111. Format => 'int16u[2]',
  2112. },
  2113. 0x03 => {
  2114. Name => 'FacesDetected',
  2115. DataMember => 'FacesDetected',
  2116. RawConv => '$$self{FacesDetected} = $val',
  2117. },
  2118. 0x04 => {
  2119. Name => 'Face1Position',
  2120. Format => 'int16u[4]',
  2121. RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
  2122. Notes => q{
  2123. top, left, width and height of face detect area in coordinates of
  2124. FaceDetectFrameSize
  2125. },
  2126. },
  2127. 0x08 => {
  2128. Name => 'Face2Position',
  2129. Format => 'int16u[4]',
  2130. RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
  2131. },
  2132. 0x0c => {
  2133. Name => 'Face3Position',
  2134. Format => 'int16u[4]',
  2135. RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
  2136. },
  2137. 0x10 => {
  2138. Name => 'Face4Position',
  2139. Format => 'int16u[4]',
  2140. RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
  2141. },
  2142. 0x14 => {
  2143. Name => 'Face5Position',
  2144. Format => 'int16u[4]',
  2145. RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
  2146. },
  2147. 0x18 => {
  2148. Name => 'Face6Position',
  2149. Format => 'int16u[4]',
  2150. RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
  2151. },
  2152. 0x1c => {
  2153. Name => 'Face7Position',
  2154. Format => 'int16u[4]',
  2155. RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
  2156. },
  2157. 0x20 => {
  2158. Name => 'Face8Position',
  2159. Format => 'int16u[4]',
  2160. RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
  2161. },
  2162. 0x24 => {
  2163. Name => 'Face9Position',
  2164. Format => 'int16u[4]',
  2165. RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
  2166. },
  2167. 0x28 => {
  2168. Name => 'Face10Position',
  2169. Format => 'int16u[4]',
  2170. RawConv => '$$self{FacesDetected} < 10 ? undef : $val',
  2171. },
  2172. 0x2c => {
  2173. Name => 'Face11Position',
  2174. Format => 'int16u[4]',
  2175. RawConv => '$$self{FacesDetected} < 11 ? undef : $val',
  2176. },
  2177. 0x30 => {
  2178. Name => 'Face12Position',
  2179. Format => 'int16u[4]',
  2180. RawConv => '$$self{FacesDetected} < 12 ? undef : $val',
  2181. },
  2182. );
  2183. # Picture Control information - PH (D300,P6000)
  2184. %Image::ExifTool::Nikon::PictureControl = (
  2185. %binaryDataAttrs,
  2186. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2187. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  2188. 0 => {
  2189. Name => 'PictureControlVersion',
  2190. Format => 'undef[4]',
  2191. Writable => 0,
  2192. },
  2193. 4 => {
  2194. Name => 'PictureControlName',
  2195. Format => 'string[20]',
  2196. # make lower case with a leading capital for each word
  2197. PrintConv => \&FormatString,
  2198. PrintConvInv => 'uc($val)',
  2199. },
  2200. 24 => {
  2201. Name => 'PictureControlBase',
  2202. Format => 'string[20]',
  2203. PrintConv => \&FormatString,
  2204. PrintConvInv => 'uc($val)',
  2205. },
  2206. # beginning at byte 44, there is some interesting information.
  2207. # here are the observed bytes for each PictureControlMode:
  2208. # 44 45 46 47 48 49 50 51 52 53 54 55 56 57
  2209. # STANDARD 00 01 00 00 00 80 83 80 80 80 80 ff ff ff
  2210. # NEUTRAL 03 c2 00 00 00 ff 82 80 80 80 80 ff ff ff
  2211. # VIVID 00 c3 00 00 00 80 84 80 80 80 80 ff ff ff
  2212. # MONOCHROME 06 4d 00 01 02 ff 82 80 80 ff ff 80 80 ff
  2213. # Neutral2 03 c2 01 00 02 ff 80 7f 81 00 7f ff ff ff (custom)
  2214. # (note that up to 9 different custom picture controls can be stored)
  2215. # --> bytes 44 and 45 are swapped if CaptureNX changes the byte order
  2216. #
  2217. 48 => { #21
  2218. Name => 'PictureControlAdjust',
  2219. PrintConv => {
  2220. 0 => 'Default Settings',
  2221. 1 => 'Quick Adjust',
  2222. 2 => 'Full Control',
  2223. },
  2224. },
  2225. 49 => {
  2226. Name => 'PictureControlQuickAdjust',
  2227. # settings: -2 to +2 (n/a for Neutral and Monochrome modes)
  2228. DelValue => 0xff,
  2229. ValueConv => '$val - 0x80',
  2230. ValueConvInv => '$val + 0x80',
  2231. PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
  2232. PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
  2233. },
  2234. 50 => {
  2235. Name => 'Sharpness',
  2236. # settings: 0 to 9, Auto
  2237. ValueConv => '$val - 0x80',
  2238. ValueConvInv => '$val + 0x80',
  2239. PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"No Sharpening","%d")',
  2240. PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
  2241. },
  2242. 51 => {
  2243. Name => 'Contrast',
  2244. # settings: -3 to +3, Auto
  2245. ValueConv => '$val - 0x80',
  2246. ValueConvInv => '$val + 0x80',
  2247. PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
  2248. PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
  2249. },
  2250. 52 => {
  2251. Name => 'Brightness',
  2252. # settings: -1 to +1
  2253. ValueConv => '$val - 0x80',
  2254. ValueConvInv => '$val + 0x80',
  2255. PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
  2256. PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
  2257. },
  2258. 53 => {
  2259. Name => 'Saturation',
  2260. # settings: -3 to +3, Auto (n/a for Monochrome mode)
  2261. DelValue => 0xff,
  2262. ValueConv => '$val - 0x80',
  2263. ValueConvInv => '$val + 0x80',
  2264. PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
  2265. PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
  2266. },
  2267. 54 => {
  2268. Name => 'HueAdjustment',
  2269. # settings: -3 to +3 (n/a for Monochrome mode)
  2270. DelValue => 0xff,
  2271. ValueConv => '$val - 0x80',
  2272. ValueConvInv => '$val + 0x80',
  2273. PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None")',
  2274. PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
  2275. },
  2276. 55 => {
  2277. Name => 'FilterEffect',
  2278. # settings: Off,Yellow,Orange,Red,Green (n/a for color modes)
  2279. DelValue => 0xff,
  2280. PrintHex => 1,
  2281. PrintConv => {
  2282. 0x80 => 'Off',
  2283. 0x81 => 'Yellow',
  2284. 0x82 => 'Orange',
  2285. 0x83 => 'Red',
  2286. 0x84 => 'Green',
  2287. 0xff => 'n/a',
  2288. },
  2289. },
  2290. 56 => {
  2291. Name => 'ToningEffect',
  2292. # settings: B&W,Sepia,Cyanotype,Red,Yellow,Green,Blue-Green,Blue,
  2293. # Purple-Blue,Red-Purple (n/a for color modes)
  2294. DelValue => 0xff,
  2295. PrintHex => 1,
  2296. PrintConvColumns => 2,
  2297. PrintConv => {
  2298. 0x80 => 'B&W',
  2299. 0x81 => 'Sepia',
  2300. 0x82 => 'Cyanotype',
  2301. 0x83 => 'Red',
  2302. 0x84 => 'Yellow',
  2303. 0x85 => 'Green',
  2304. 0x86 => 'Blue-green',
  2305. 0x87 => 'Blue',
  2306. 0x88 => 'Purple-blue',
  2307. 0x89 => 'Red-purple',
  2308. 0xff => 'n/a',
  2309. # 0x04 - seen for D810 (PH)
  2310. },
  2311. },
  2312. 57 => { #21
  2313. Name => 'ToningSaturation',
  2314. # settings: B&W,Sepia,Cyanotype,Red,Yellow,Green,Blue-Green,Blue,
  2315. # Purple-Blue,Red-Purple (n/a unless ToningEffect is used)
  2316. DelValue => 0xff,
  2317. ValueConv => '$val - 0x80',
  2318. ValueConvInv => '$val + 0x80',
  2319. PrintConv => '$val==0x7f ? "n/a" : $val',
  2320. PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
  2321. },
  2322. );
  2323. # World Time information - JD (D300)
  2324. %Image::ExifTool::Nikon::WorldTime = (
  2325. %binaryDataAttrs,
  2326. GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
  2327. 0 => {
  2328. Name => 'TimeZone',
  2329. Format => 'int16s',
  2330. PrintConv => q{
  2331. my $sign = $val < 0 ? '-' : '+';
  2332. my $h = int(abs($val) / 60);
  2333. sprintf("%s%.2d:%.2d", $sign, $h, abs($val)-60*$h);
  2334. },
  2335. PrintConvInv => q{
  2336. $val =~ /([-+]?)(\d+):(\d+)/ or return undef;
  2337. return $1 . ($2 * 60 + $3);
  2338. },
  2339. },
  2340. 2 => {
  2341. Name => 'DaylightSavings',
  2342. PrintConv => { 0 => 'No', 1 => 'Yes' },
  2343. },
  2344. 3 => {
  2345. Name => 'DateDisplayFormat',
  2346. PrintConv => {
  2347. 0 => 'Y/M/D',
  2348. 1 => 'M/D/Y',
  2349. 2 => 'D/M/Y',
  2350. },
  2351. },
  2352. );
  2353. # ISO information - PH (D300)
  2354. %Image::ExifTool::Nikon::ISOInfo = (
  2355. %binaryDataAttrs,
  2356. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2357. 0 => {
  2358. Name => 'ISO',
  2359. Notes => 'val = 100 * 2**(raw/12-5)',
  2360. Priority => 0, # because people like to see rounded-off values if they exist
  2361. ValueConv => '100*exp(($val/12-5)*log(2))',
  2362. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  2363. PrintConv => 'int($val + 0.5)',
  2364. PrintConvInv => '$val',
  2365. },
  2366. # 1 - 0x01
  2367. # 2 - 0x0c (probably the ISO divisor above)
  2368. # 3 - 0x00
  2369. 4 => {
  2370. Name => 'ISOExpansion',
  2371. Format => 'int16u',
  2372. PrintHex => 1,
  2373. PrintConvColumns => 2,
  2374. PrintConv => {
  2375. 0x000 => 'Off',
  2376. 0x101 => 'Hi 0.3',
  2377. 0x102 => 'Hi 0.5',
  2378. 0x103 => 'Hi 0.7',
  2379. 0x104 => 'Hi 1.0',
  2380. 0x105 => 'Hi 1.3', # (Hi 1.3-1.7 may be possible with future models)
  2381. 0x106 => 'Hi 1.5',
  2382. 0x107 => 'Hi 1.7',
  2383. 0x108 => 'Hi 2.0', #(NC) - D3 should have this mode
  2384. 0x109 => 'Hi 2.3', #33
  2385. 0x10a => 'Hi 2.5', #33
  2386. 0x10b => 'Hi 2.7', #33
  2387. 0x10c => 'Hi 3.0', #33
  2388. 0x10d => 'Hi 3.3', #33
  2389. 0x10e => 'Hi 3.5', #33
  2390. 0x10f => 'Hi 3.7', #33
  2391. 0x110 => 'Hi 4.0', #33
  2392. 0x201 => 'Lo 0.3',
  2393. 0x202 => 'Lo 0.5',
  2394. 0x203 => 'Lo 0.7',
  2395. 0x204 => 'Lo 1.0',
  2396. },
  2397. },
  2398. # bytes 6-11 same as 0-4 in my samples (why is this duplicated?)
  2399. 6 => {
  2400. Name => 'ISO2',
  2401. Notes => 'val = 100 * 2**(raw/12-5)',
  2402. ValueConv => '100*exp(($val/12-5)*log(2))',
  2403. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  2404. PrintConv => 'int($val + 0.5)',
  2405. PrintConvInv => '$val',
  2406. },
  2407. # 7 - 0x01
  2408. # 8 - 0x0c (probably the ISO divisor above)
  2409. # 9 - 0x00
  2410. 10 => {
  2411. Name => 'ISOExpansion2',
  2412. Format => 'int16u',
  2413. PrintHex => 1,
  2414. PrintConvColumns => 2,
  2415. PrintConv => {
  2416. 0x000 => 'Off',
  2417. 0x101 => 'Hi 0.3',
  2418. 0x102 => 'Hi 0.5',
  2419. 0x103 => 'Hi 0.7',
  2420. 0x104 => 'Hi 1.0',
  2421. 0x105 => 'Hi 1.3', # (Hi 1.3-1.7 may be possible with future models)
  2422. 0x106 => 'Hi 1.5',
  2423. 0x107 => 'Hi 1.7',
  2424. 0x108 => 'Hi 2.0', #(NC) - D3 should have this mode
  2425. 0x201 => 'Lo 0.3',
  2426. 0x202 => 'Lo 0.5',
  2427. 0x203 => 'Lo 0.7',
  2428. 0x204 => 'Lo 1.0',
  2429. },
  2430. },
  2431. # bytes 12-13: 00 00
  2432. );
  2433. # distortion information - PH (D5000)
  2434. %Image::ExifTool::Nikon::DistortInfo = (
  2435. %binaryDataAttrs,
  2436. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2437. 0 => {
  2438. Name => 'DistortionVersion',
  2439. Format => 'undef[4]',
  2440. Writable => 0,
  2441. Unknown => 1,
  2442. },
  2443. 4 => {
  2444. Name => 'AutoDistortionControl',
  2445. PrintConv => {
  2446. 0 => 'Off',
  2447. 1 => 'On',
  2448. 2 => 'On (underwater)', # (1AW1)
  2449. },
  2450. },
  2451. );
  2452. # unknown information - PH (D7000)
  2453. %Image::ExifTool::Nikon::UnknownInfo = (
  2454. %binaryDataAttrs,
  2455. FORMAT => 'int32u',
  2456. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2457. 0 => {
  2458. Name => 'UnknownInfoVersion',
  2459. Condition => '$$valPt =~ /^\d{4}/',
  2460. Format => 'undef[4]',
  2461. Writable => 0,
  2462. Unknown => 1,
  2463. },
  2464. # (bytes 6/7 and 8/9 are swapped if CaptureNX changes the byte order)
  2465. );
  2466. # more unknown information - PH (D7000)
  2467. %Image::ExifTool::Nikon::UnknownInfo2 = (
  2468. %binaryDataAttrs,
  2469. FORMAT => 'int32u',
  2470. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2471. 0 => {
  2472. Name => 'UnknownInfo2Version',
  2473. Condition => '$$valPt =~ /^\d{4}/',
  2474. Format => 'undef[4]',
  2475. Writable => 0,
  2476. Unknown => 1,
  2477. },
  2478. # (byte 4 may be changed from 1 to 0 when rewritten by CaptureNX)
  2479. );
  2480. # Nikon AF information (ref 13)
  2481. %Image::ExifTool::Nikon::AFInfo = (
  2482. %binaryDataAttrs,
  2483. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2484. 0 => {
  2485. Name => 'AFAreaMode',
  2486. PrintConv => {
  2487. 0 => 'Single Area',
  2488. 1 => 'Dynamic Area',
  2489. 2 => 'Dynamic Area (closest subject)',
  2490. 3 => 'Group Dynamic',
  2491. 4 => 'Single Area (wide)',
  2492. 5 => 'Dynamic Area (wide)',
  2493. },
  2494. },
  2495. 1 => {
  2496. Name => 'AFPoint',
  2497. Notes => 'in some focus modes this value is not meaningful',
  2498. PrintConvColumns => 2,
  2499. PrintConv => {
  2500. 0 => 'Center',
  2501. 1 => 'Top',
  2502. 2 => 'Bottom',
  2503. 3 => 'Mid-left',
  2504. 4 => 'Mid-right',
  2505. 5 => 'Upper-left',
  2506. 6 => 'Upper-right',
  2507. 7 => 'Lower-left',
  2508. 8 => 'Lower-right',
  2509. 9 => 'Far Left',
  2510. 10 => 'Far Right',
  2511. },
  2512. },
  2513. 2 => {
  2514. Name => 'AFPointsInFocus',
  2515. Format => 'int16u',
  2516. PrintConvColumns => 2,
  2517. PrintConv => {
  2518. 0 => '(none)',
  2519. 0x7ff => 'All 11 Points',
  2520. BITMASK => {
  2521. 0 => 'Center',
  2522. 1 => 'Top',
  2523. 2 => 'Bottom',
  2524. 3 => 'Mid-left',
  2525. 4 => 'Mid-right',
  2526. 5 => 'Upper-left',
  2527. 6 => 'Upper-right',
  2528. 7 => 'Lower-left',
  2529. 8 => 'Lower-right',
  2530. 9 => 'Far Left',
  2531. 10 => 'Far Right',
  2532. },
  2533. },
  2534. },
  2535. );
  2536. # Nikon AF information for D3 and D300 (ref JD)
  2537. %Image::ExifTool::Nikon::AFInfo2 = (
  2538. %binaryDataAttrs,
  2539. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2540. DATAMEMBER => [ 0, 4, 6 ],
  2541. NOTES => "These tags are written by Nikon DSLR's which have the live view feature.",
  2542. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  2543. 0 => {
  2544. Name => 'AFInfo2Version',
  2545. Format => 'undef[4]',
  2546. Writable => 0,
  2547. RawConv => '$$self{AFInfo2Version} = $val',
  2548. },
  2549. 4 => { #PH
  2550. Name => 'ContrastDetectAF',
  2551. RawConv => '$$self{ContrastDetectAF} = $val',
  2552. PrintConv => \%offOn,
  2553. Notes => 'this is Off for the hybrid AF used in Nikon 1 models',
  2554. },
  2555. 5 => [
  2556. {
  2557. Name => 'AFAreaMode',
  2558. Condition => 'not $$self{ContrastDetectAF}',
  2559. Notes => 'ContrastDetectAF Off',
  2560. PrintConv => {
  2561. 0 => 'Single Area', # (called "Single Point" in manual - PH)
  2562. 1 => 'Dynamic Area', #PH
  2563. 2 => 'Dynamic Area (closest subject)', #PH
  2564. 3 => 'Group Dynamic', #PH
  2565. 4 => 'Dynamic Area (9 points)', #JD/28
  2566. 5 => 'Dynamic Area (21 points)', #28
  2567. 6 => 'Dynamic Area (51 points)', #28
  2568. 7 => 'Dynamic Area (51 points, 3D-tracking)', #PH/28
  2569. 8 => 'Auto-area',
  2570. 9 => 'Dynamic Area (3D-tracking)', #PH (D5000 "3D-tracking (11 points)")
  2571. 10 => 'Single Area (wide)', #PH
  2572. 11 => 'Dynamic Area (wide)', #PH
  2573. 12 => 'Dynamic Area (wide, 3D-tracking)', #PH
  2574. 128 => 'Single', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V2,1V3)
  2575. 129 => 'Auto (41 points)', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V1,1V2,1V3,AW1)
  2576. 130 => 'Subject Tracking (41 points)', #PH (1J1,1J4,1J3)
  2577. 131 => 'Face Priority (41 points)', #PH (1J1,1J3,1S1,1V2,AW1)
  2578. # 134 - seen for 1V1[PhaseDetectAF=0] (PH)
  2579. # 135 - seen for 1J2[PhaseDetectAF=4] (PH)
  2580. },
  2581. },
  2582. { #PH (D3/D90/D5000)
  2583. Name => 'AFAreaMode',
  2584. Notes => 'ContrastDetectAF On',
  2585. PrintConv => {
  2586. 0 => 'Contrast-detect', # (D3)
  2587. 1 => 'Contrast-detect (normal area)', # (D90/D5000)
  2588. # (D90 and D5000 give value of 2 when set to 'Face Priority' and
  2589. # 'Subject Tracking', but I didn't have a face to shoot at or a
  2590. # moving subject to track so perhaps this value changes dynamically)
  2591. 2 => 'Contrast-detect (wide area)', # (D90/D5000)
  2592. 3 => 'Contrast-detect (face priority)', # (ViewNX)
  2593. 4 => 'Contrast-detect (subject tracking)', # (ViewNX)
  2594. 128 => 'Single', #PH (1V3)
  2595. 129 => 'Auto (41 points)', #PH (NC)
  2596. 130 => 'Subject Tracking (41 points)', #PH (NC)
  2597. 131 => 'Face Priority (41 points)', #PH (NC)
  2598. },
  2599. },
  2600. ],
  2601. 6 => {
  2602. Name => 'PhaseDetectAF', #JD(AutoFocus), PH(PhaseDetectAF)
  2603. Notes => 'PrimaryAFPoint and AFPointsUsed below are only valid when this is On',
  2604. RawConv => '$$self{PhaseDetectAF} = $val',
  2605. PrintConv => {
  2606. # [observed AFAreaMode values in square brackets for each PhaseDetectAF value]
  2607. 0 => 'Off',
  2608. 1 => 'On (51-point)', #PH
  2609. 2 => 'On (11-point)', #PH
  2610. 3 => 'On (39-point)', #29 (D7000)
  2611. 4 => 'On (73-point)', #PH (1J1[128/129],1J2[128/129/135],1J3/1S1/1V2[128/129/131],1V1[129],AW1[129/131])
  2612. 5 => 'On (5)', #PH (1S2[128/129], 1J4/1V3[129])
  2613. 6 => 'On (105-point)', #PH (1J4/1V3[128/130])
  2614. },
  2615. },
  2616. 7 => [
  2617. { #PH/JD
  2618. Name => 'PrimaryAFPoint',
  2619. Condition => '$$self{PhaseDetectAF} < 2',
  2620. Notes => 'models with 51-point AF: D3, D3S, D3X, D300, D300S, D700 and D800',
  2621. PrintConvColumns => 5,
  2622. PrintConv => {
  2623. 0 => '(none)',
  2624. %afPoints51,
  2625. 1 => 'C6 (Center)', # (add " (Center)" to central point)
  2626. },
  2627. },
  2628. { #10
  2629. Name => 'PrimaryAFPoint',
  2630. Notes => 'models with 11-point AF: D90, D3000, D3100, D5000 and D5100',
  2631. Condition => '$$self{PhaseDetectAF} == 2',
  2632. PrintConvColumns => 2,
  2633. PrintConv => {
  2634. 0 => '(none)',
  2635. 1 => 'Center',
  2636. 2 => 'Top',
  2637. 3 => 'Bottom',
  2638. 4 => 'Mid-left',
  2639. 5 => 'Upper-left',
  2640. 6 => 'Lower-left',
  2641. 7 => 'Far Left',
  2642. 8 => 'Mid-right',
  2643. 9 => 'Upper-right',
  2644. 10 => 'Lower-right',
  2645. 11 => 'Far Right',
  2646. },
  2647. },
  2648. { #29
  2649. Name => 'PrimaryAFPoint',
  2650. Condition => '$$self{PhaseDetectAF} == 3',
  2651. Notes => 'models with 39-point AF: D600 and D7000',
  2652. PrintConvColumns => 5,
  2653. PrintConv => {
  2654. 0 => '(none)',
  2655. %afPoints39,
  2656. 1 => 'C6 (Center)', # (add " (Center)" to central point)
  2657. },
  2658. },
  2659. { #PH
  2660. Name => 'PrimaryAFPoint',
  2661. Condition => '$$self{PhaseDetectAF} == 4',
  2662. Notes => 'Nikon 1 models with older 135-point AF and 73-point phase-detect AF',
  2663. PrintConvColumns => 5,
  2664. PrintConv => {
  2665. 0 => '(none)',
  2666. %afPoints135,
  2667. 1 => 'E8 (Center)', # (add " (Center)" to central point)
  2668. },
  2669. },
  2670. { #PH (NC)
  2671. Name => 'PrimaryAFPoint',
  2672. Condition => '$$self{PhaseDetectAF} == 5',
  2673. Notes => q{
  2674. Nikon 1 models with newer 135-point AF and 73-point phase-detect AF -- 9
  2675. rows (B-J) and 15 columns (1-15), inside a grid of 11 rows by 15 columns.
  2676. The points are numbered sequentially, with F8 at the center
  2677. },
  2678. PrintConv => {
  2679. 0 => '(none)',
  2680. 82 => 'F8 (Center)',
  2681. OTHER => sub {
  2682. my ($val, $inv) = @_;
  2683. return GetAFPointGrid($val, 15, $inv);
  2684. },
  2685. },
  2686. },
  2687. { #PH
  2688. Name => 'PrimaryAFPoint',
  2689. Condition => '$$self{PhaseDetectAF} == 6',
  2690. Notes => q{
  2691. Nikon 1 models with 171-point AF and 105-point phase-detect AF -- 9 rows
  2692. (B-J) and 19 columns (2-20), inside a grid of 11 rows by 21 columns. The
  2693. points are numbered sequentially, with F11 at the center
  2694. },
  2695. PrintConv => {
  2696. 0 => '(none)',
  2697. #22 => 'B2 (Top-left)',
  2698. #40 => 'B20 (Top-right)',
  2699. 115 => 'F11 (Center)',
  2700. #190 => 'J2 (Bottom-left)',
  2701. #208 => 'J20 (Bottom-right)',
  2702. OTHER => sub {
  2703. my ($val, $inv) = @_;
  2704. return GetAFPointGrid($val, 21, $inv);
  2705. },
  2706. },
  2707. },
  2708. {
  2709. Name => 'PrimaryAFPoint',
  2710. Notes => 'future models?...',
  2711. PrintConv => {
  2712. 0 => '(none)',
  2713. 1 => 'Center',
  2714. },
  2715. },
  2716. ],
  2717. 8 => [
  2718. { #JD/PH
  2719. Name => 'AFPointsUsed',
  2720. Condition => '$$self{PhaseDetectAF} < 2',
  2721. Notes => q{
  2722. models with 51-point AF -- 5 rows: A1-9, B1-11, C1-11, D1-11, E1-9. Center
  2723. point is C6
  2724. },
  2725. Format => 'undef[7]',
  2726. ValueConv => 'join(" ", unpack("H2"x7, $val))',
  2727. ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
  2728. PrintConv => sub { PrintAFPoints(shift, \%afPoints51); },
  2729. PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51, 7); },
  2730. },
  2731. { #10
  2732. Name => 'AFPointsUsed',
  2733. Condition => '$$self{PhaseDetectAF} == 2',
  2734. Notes => 'models with 11-point AF',
  2735. # read as int16u in little-endian byte order
  2736. Format => 'undef[2]',
  2737. ValueConv => 'unpack("v",$val)',
  2738. ValueConvInv => 'pack("v",$val)',
  2739. PrintConvColumns => 2,
  2740. PrintConv => {
  2741. 0 => '(none)',
  2742. 0x7ff => 'All 11 Points',
  2743. BITMASK => {
  2744. 0 => 'Center',
  2745. 1 => 'Top',
  2746. 2 => 'Bottom',
  2747. 3 => 'Mid-left',
  2748. 4 => 'Upper-left',
  2749. 5 => 'Lower-left',
  2750. 6 => 'Far Left',
  2751. 7 => 'Mid-right',
  2752. 8 => 'Upper-right',
  2753. 9 => 'Lower-right',
  2754. 10 => 'Far Right',
  2755. },
  2756. },
  2757. },
  2758. { #29/PH
  2759. Name => 'AFPointsUsed',
  2760. Condition => '$$self{PhaseDetectAF} == 3',
  2761. Notes => q{
  2762. models with 39-point AF -- 5 rows: A1-3, B1-11, C1-11, D1-11, E1-3. Center
  2763. point is C6
  2764. },
  2765. Format => 'undef[7]',
  2766. ValueConv => 'join(" ", unpack("H2"x7, $val))',
  2767. ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
  2768. PrintConv => sub { PrintAFPoints(shift, \%afPoints39); },
  2769. PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints39, 7); },
  2770. },
  2771. { #PH (1AW1,1J1,1J2,1J3,1S1,1V1,1V2)
  2772. Name => 'AFPointsUsed',
  2773. Condition => '$$self{PhaseDetectAF} == 4',
  2774. Notes => q{
  2775. older models with 135-point AF -- 9 rows (A-I) and 15 columns (1-15).
  2776. Center point is E8. The odd-numbered columns, columns 2 and 14, and the
  2777. remaining corner points are not used for 41-point AF mode
  2778. },
  2779. Format => 'undef[17]',
  2780. ValueConv => 'join(" ", unpack("H2"x17, $val))',
  2781. ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
  2782. PrintConv => sub { PrintAFPoints(shift, \%afPoints135); },
  2783. PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints135, 17); },
  2784. },
  2785. { #PH (1S2)
  2786. Name => 'AFPointsUsed',
  2787. Condition => '$$self{PhaseDetectAF} == 5',
  2788. Notes => q{
  2789. newer models with 135-point AF -- 9 rows (B-J) and 15 colums (1-15). Center
  2790. point is F8
  2791. },
  2792. Format => 'undef[21]',
  2793. ValueConv => 'join(" ", unpack("H2"x21, $val))',
  2794. ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
  2795. PrintConv => sub { PrintAFPointsGrid(shift, 15); },
  2796. PrintConvInv => sub { PrintAFPointsGridInv(shift, 15, 21); },
  2797. },
  2798. { #PH (1J4,1V3)
  2799. Name => 'AFPointsUsed',
  2800. Condition => '$$self{PhaseDetectAF} == 6',
  2801. Notes => q{
  2802. models with 171-point AF -- 9 rows (B-J) and 19 columns (2-20). Center
  2803. point is F10
  2804. },
  2805. Format => 'undef[29]',
  2806. ValueConv => 'join(" ", unpack("H2"x29, $val))',
  2807. ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
  2808. PrintConv => sub { PrintAFPointsGrid(shift, 21); },
  2809. PrintConvInv => sub { PrintAFPointsGridInv(shift, 21, 29); },
  2810. },
  2811. {
  2812. Name => 'AFPointsUsed',
  2813. Format => 'undef[7]',
  2814. ValueConv => 'join(" ", unpack("H2"x7, $val))',
  2815. ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
  2816. PrintConv => '"Unknown ($val)"',
  2817. PrintConvInv => '$val=~s/Unknown \\((.*)\\)/$1/; $val',
  2818. },
  2819. ],
  2820. 0x10 => { #PH (D90 and D5000)
  2821. Name => 'AFImageWidth',
  2822. Condition => '$$self{AFInfo2Version} eq "0100"',
  2823. Format => 'int16u',
  2824. RawConv => '$val ? $val : undef',
  2825. Notes => 'this and the following tags are valid only for contrast-detect AF',
  2826. },
  2827. 0x12 => { #PH
  2828. Name => 'AFImageHeight',
  2829. Condition => '$$self{AFInfo2Version} eq "0100"',
  2830. Format => 'int16u',
  2831. RawConv => '$val ? $val : undef',
  2832. },
  2833. 0x14 => { #PH
  2834. Name => 'AFAreaXPosition',
  2835. Condition => '$$self{AFInfo2Version} eq "0100"',
  2836. Notes => 'center of AF area in AFImage coordinates',
  2837. Format => 'int16u',
  2838. RawConv => '$val ? $val : undef',
  2839. },
  2840. 0x16 => { #PH
  2841. Name => 'AFAreaYPosition',
  2842. Condition => '$$self{AFInfo2Version} eq "0100"',
  2843. Format => 'int16u',
  2844. RawConv => '$val ? $val : undef',
  2845. },
  2846. # AFAreaWidth/Height for the D90 and D5000:
  2847. # 352x288 (AF normal area),
  2848. # 704x576 (AF face priority, wide area, subject tracking)
  2849. 0x18 => { #PH
  2850. Name => 'AFAreaWidth',
  2851. Condition => '$$self{AFInfo2Version} eq "0100"',
  2852. Format => 'int16u',
  2853. Notes => 'size of AF area in AFImage coordinates',
  2854. RawConv => '$val ? $val : undef',
  2855. },
  2856. 0x1a => { #PH
  2857. Name => 'AFAreaHeight',
  2858. Condition => '$$self{AFInfo2Version} eq "0100"',
  2859. Format => 'int16u',
  2860. RawConv => '$val ? $val : undef',
  2861. },
  2862. 0x1c => { #PH
  2863. Name => 'ContrastDetectAFInFocus',
  2864. Condition => '$$self{AFInfo2Version} eq "0100"',
  2865. PrintConv => { 0 => 'No', 1 => 'Yes' },
  2866. },
  2867. # 0x1d - always zero (with or without live view)
  2868. );
  2869. # Nikon AF fine-tune information (ref 28)
  2870. %Image::ExifTool::Nikon::AFTune = (
  2871. %binaryDataAttrs,
  2872. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2873. 0 => {
  2874. Name => 'AFFineTune',
  2875. PrintConv => {
  2876. 0 => 'Off',
  2877. # (don't know what the difference between 1 and 2 is)
  2878. 1 => 'On (1)',
  2879. 2 => 'On (2)',
  2880. },
  2881. },
  2882. 1 => {
  2883. Name => 'AFFineTuneIndex',
  2884. Notes => 'index of saved lens',
  2885. PrintConv => '$val == 255 ? "n/a" : $val',
  2886. PrintConvInv => '$val eq "n/a" ? 255 : $val',
  2887. },
  2888. 2 => {
  2889. Name => 'AFFineTuneAdj',
  2890. Priority => 0, # so other value takes priority if it exists
  2891. Notes => 'may only be valid for saved lenses',
  2892. Format => 'int8s',
  2893. PrintConv => '$val > 0 ? "+$val" : $val',
  2894. PrintConvInv => '$val',
  2895. },
  2896. );
  2897. # Nikon NEF processing information (ref forum6281)
  2898. %Image::ExifTool::Nikon::RetouchInfo = (
  2899. %binaryDataAttrs,
  2900. FORMAT => 'int8s',
  2901. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2902. DATAMEMBER => [ 0 ],
  2903. 0 => {
  2904. Name => 'RetouchInfoVersion',
  2905. Format => 'undef[4]',
  2906. Writable => 0,
  2907. RawConv => '$$self{RetouchInfoVersion} = $val',
  2908. },
  2909. # 4 - RetouchExposureComp (+$val/6 or -$val/6?)
  2910. 5 => {
  2911. Name => 'RetouchNEFProcessing',
  2912. Condition => '$$self{RetouchInfoVersion} ge "0200"',
  2913. PrintConv => {
  2914. -1 => 'Off',
  2915. 1 => 'On',
  2916. },
  2917. },
  2918. );
  2919. # Nikon File information - D60, D3 and D300 (ref PH)
  2920. %Image::ExifTool::Nikon::FileInfo = (
  2921. %binaryDataAttrs,
  2922. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  2923. FORMAT => 'int16u',
  2924. 0 => {
  2925. Name => 'FileInfoVersion',
  2926. Format => 'undef[4]',
  2927. Writable => 0,
  2928. },
  2929. 3 => {
  2930. Name => 'DirectoryNumber',
  2931. PrintConv => 'sprintf("%.3d", $val)',
  2932. PrintConvInv => '$val',
  2933. },
  2934. 4 => {
  2935. Name => 'FileNumber',
  2936. PrintConv => 'sprintf("%.4d", $val)',
  2937. PrintConvInv => '$val',
  2938. },
  2939. );
  2940. # ref PH
  2941. %Image::ExifTool::Nikon::BarometerInfo = (
  2942. %binaryDataAttrs,
  2943. GROUPS => { 0 => 'MakerNotes', 2 => 'Location' },
  2944. 0 => {
  2945. Name => 'BarometerInfoVersion',
  2946. Format => 'undef[4]',
  2947. Writable => 0,
  2948. },
  2949. 6 => {
  2950. Name => 'Altitude',
  2951. Format => 'int32s',
  2952. PrintConv => '"$val m"', # (always stored as metres)
  2953. PrintConvInv => '$val=~s/\s*m$//; $val',
  2954. },
  2955. # 10: int16u - values: 0 (display in metres?), 18 (display in feet?)
  2956. );
  2957. # ref PH
  2958. %Image::ExifTool::Nikon::CaptureOffsets = (
  2959. PROCESS_PROC => \&ProcessNikonCaptureOffsets,
  2960. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2961. 1 => 'IFD0_Offset',
  2962. 2 => 'PreviewIFD_Offset',
  2963. 3 => 'SubIFD_Offset',
  2964. );
  2965. # ref PH (Written by capture NX)
  2966. %Image::ExifTool::Nikon::CaptureOutput = (
  2967. %binaryDataAttrs,
  2968. FORMAT => 'int32u',
  2969. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  2970. # 1 = 1
  2971. 2 => 'OutputImageWidth',
  2972. 3 => 'OutputImageHeight',
  2973. 4 => 'OutputResolution',
  2974. # 5 = 1
  2975. );
  2976. # ref 4
  2977. %Image::ExifTool::Nikon::ColorBalanceA = (
  2978. %binaryDataAttrs,
  2979. FORMAT => 'int16u',
  2980. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2981. 624 => {
  2982. Name => 'RedBalance',
  2983. ValueConv => '$val / 256',
  2984. ValueConvInv => '$val * 256',
  2985. Protected => 1,
  2986. },
  2987. 625 => {
  2988. Name => 'BlueBalance',
  2989. ValueConv => '$val / 256',
  2990. ValueConvInv => '$val * 256',
  2991. Protected => 1,
  2992. },
  2993. );
  2994. # ref 4
  2995. %Image::ExifTool::Nikon::ColorBalance1 = (
  2996. %binaryDataAttrs,
  2997. FORMAT => 'int16u',
  2998. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2999. 0 => {
  3000. Name => 'WB_RBGGLevels',
  3001. Format => 'int16u[4]',
  3002. Protected => 1,
  3003. },
  3004. );
  3005. # ref 4
  3006. %Image::ExifTool::Nikon::ColorBalance2 = (
  3007. %binaryDataAttrs,
  3008. FORMAT => 'int16u',
  3009. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3010. NOTES => 'This information is encrypted for most camera models.',
  3011. 0 => {
  3012. Name => 'WB_RGGBLevels',
  3013. Format => 'int16u[4]',
  3014. Protected => 1,
  3015. },
  3016. );
  3017. # ref 4
  3018. %Image::ExifTool::Nikon::ColorBalance3 = (
  3019. %binaryDataAttrs,
  3020. FORMAT => 'int16u',
  3021. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3022. 0 => {
  3023. Name => 'WB_RGBGLevels',
  3024. Format => 'int16u[4]',
  3025. Protected => 1,
  3026. },
  3027. );
  3028. # ref 4
  3029. %Image::ExifTool::Nikon::ColorBalance4 = (
  3030. %binaryDataAttrs,
  3031. FORMAT => 'int16u',
  3032. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3033. 0 => {
  3034. Name => 'WB_GRBGLevels',
  3035. Format => 'int16u[4]',
  3036. Protected => 1,
  3037. },
  3038. );
  3039. %Image::ExifTool::Nikon::ColorBalanceUnknown = (
  3040. %binaryDataAttrs,
  3041. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3042. 0 => {
  3043. Name => 'ColorBalanceVersion',
  3044. Format => 'undef[4]',
  3045. },
  3046. );
  3047. %Image::ExifTool::Nikon::Type2 = (
  3048. WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
  3049. CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
  3050. WRITABLE => 1,
  3051. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3052. 0x0003 => 'Quality',
  3053. 0x0004 => 'ColorMode',
  3054. 0x0005 => 'ImageAdjustment',
  3055. 0x0006 => 'CCDSensitivity',
  3056. 0x0007 => 'WhiteBalance',
  3057. 0x0008 => 'Focus',
  3058. 0x000A => 'DigitalZoom',
  3059. 0x000B => 'Converter',
  3060. );
  3061. # these are standard EXIF tags, but they are duplicated here so we can
  3062. # set the family 0 group to 'MakerNotes' and set the MINOR_ERRORS flag
  3063. %Image::ExifTool::Nikon::PreviewIFD = (
  3064. WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
  3065. CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
  3066. GROUPS => { 0 => 'MakerNotes', 1 => 'PreviewIFD', 2 => 'Image'},
  3067. VARS => { MINOR_ERRORS => 1 }, # this IFD is non-essential and often corrupted
  3068. # (these tags are priority 0 by default because PreviewIFD is flagged in LOW_PRIORITY_DIR)
  3069. 0xfe => { # (not used by Nikon, but SRW images also use this table)
  3070. Name => 'SubfileType',
  3071. DataMember => 'SubfileType',
  3072. RawConv => '$$self{SubfileType} = $val',
  3073. PrintConv => \%Image::ExifTool::Exif::subfileType,
  3074. },
  3075. 0x103 => {
  3076. Name => 'Compression',
  3077. SeparateTable => 'EXIF Compression',
  3078. PrintConv => \%Image::ExifTool::Exif::compression,
  3079. },
  3080. 0x11a => 'XResolution',
  3081. 0x11b => 'YResolution',
  3082. 0x128 => {
  3083. Name => 'ResolutionUnit',
  3084. PrintConv => {
  3085. 1 => 'None',
  3086. 2 => 'inches',
  3087. 3 => 'cm',
  3088. },
  3089. },
  3090. 0x201 => {
  3091. Name => 'PreviewImageStart',
  3092. Flags => [ 'IsOffset', 'Permanent' ],
  3093. OffsetPair => 0x202,
  3094. DataTag => 'PreviewImage',
  3095. Writable => 'int32u',
  3096. Protected => 2,
  3097. },
  3098. 0x202 => {
  3099. Name => 'PreviewImageLength',
  3100. Flags => 'Permanent' ,
  3101. OffsetPair => 0x201,
  3102. DataTag => 'PreviewImage',
  3103. Writable => 'int32u',
  3104. Protected => 2,
  3105. },
  3106. 0x213 => {
  3107. Name => 'YCbCrPositioning',
  3108. PrintConv => {
  3109. 1 => 'Centered',
  3110. 2 => 'Co-sited',
  3111. },
  3112. },
  3113. );
  3114. # these are duplicated enough times to make it worthwhile to define them centrally
  3115. my %nikonApertureConversions = (
  3116. ValueConv => '2**($val/24)',
  3117. ValueConvInv => '$val>0 ? 24*log($val)/log(2) : 0',
  3118. PrintConv => 'sprintf("%.1f",$val)',
  3119. PrintConvInv => '$val',
  3120. );
  3121. my %nikonFocalConversions = (
  3122. ValueConv => '5 * 2**($val/24)',
  3123. ValueConvInv => '$val>0 ? 24*log($val/5)/log(2) : 0',
  3124. PrintConv => 'sprintf("%.1f mm",$val)',
  3125. PrintConvInv => '$val=~s/\s*mm$//;$val',
  3126. );
  3127. # Version 100 Nikon lens data
  3128. %Image::ExifTool::Nikon::LensData00 = (
  3129. %binaryDataAttrs,
  3130. NOTES => 'This structure is used by the D100, and D1X with firmware version 1.1.',
  3131. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3132. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  3133. 0x00 => {
  3134. Name => 'LensDataVersion',
  3135. Format => 'undef[4]',
  3136. Writable => 0,
  3137. },
  3138. 0x06 => { #8
  3139. Name => 'LensIDNumber',
  3140. Notes => 'see LensID values below',
  3141. },
  3142. 0x07 => { #8
  3143. Name => 'LensFStops',
  3144. ValueConv => '$val / 12',
  3145. ValueConvInv => '$val * 12',
  3146. PrintConv => 'sprintf("%.2f", $val)',
  3147. PrintConvInv => '$val',
  3148. },
  3149. 0x08 => { #8/9
  3150. Name => 'MinFocalLength',
  3151. %nikonFocalConversions,
  3152. },
  3153. 0x09 => { #8/9
  3154. Name => 'MaxFocalLength',
  3155. %nikonFocalConversions,
  3156. },
  3157. 0x0a => { #8
  3158. Name => 'MaxApertureAtMinFocal',
  3159. %nikonApertureConversions,
  3160. },
  3161. 0x0b => { #8
  3162. Name => 'MaxApertureAtMaxFocal',
  3163. %nikonApertureConversions,
  3164. },
  3165. 0x0c => 'MCUVersion', #8
  3166. );
  3167. # Nikon lens data (note: needs decrypting if LensDataVersion is 020x)
  3168. %Image::ExifTool::Nikon::LensData01 = (
  3169. %binaryDataAttrs,
  3170. NOTES => q{
  3171. Nikon encrypts the LensData information below if LensDataVersion is 0201 or
  3172. higher, but the decryption algorithm is known so the information can be
  3173. extracted.
  3174. },
  3175. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3176. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  3177. 0x00 => {
  3178. Name => 'LensDataVersion',
  3179. Format => 'string[4]',
  3180. Writable => 0,
  3181. },
  3182. 0x04 => { #8
  3183. Name => 'ExitPupilPosition',
  3184. ValueConv => '$val ? 2048 / $val : $val',
  3185. ValueConvInv => '$val ? 2048 / $val : $val',
  3186. PrintConv => 'sprintf("%.1f mm",$val)',
  3187. PrintConvInv => '$val=~s/\s*mm$//; $val',
  3188. },
  3189. 0x05 => { #8
  3190. Name => 'AFAperture',
  3191. %nikonApertureConversions,
  3192. },
  3193. 0x08 => { #8
  3194. # this seems to be 2 values: the upper nibble gives the far focus
  3195. # range and the lower nibble gives the near focus range. The values
  3196. # are in the range 1-N, where N is lens-dependent. A value of 0 for
  3197. # the far focus range indicates infinity. (ref JD)
  3198. Name => 'FocusPosition',
  3199. PrintConv => 'sprintf("0x%02x", $val)',
  3200. PrintConvInv => '$val',
  3201. },
  3202. 0x09 => { #8/9
  3203. # With older AF lenses this does not work... (ref 13)
  3204. # eg) AF Nikkor 50mm f/1.4 => 48 (0x30)
  3205. # AF Zoom-Nikkor 35-105mm f/3.5-4.5 => @35mm => 15 (0x0f), @105mm => 141 (0x8d)
  3206. Notes => 'this focus distance is approximate, and not very accurate for some lenses',
  3207. Name => 'FocusDistance',
  3208. ValueConv => '0.01 * 10**($val/40)', # in m
  3209. ValueConvInv => '$val>0 ? 40*log($val*100)/log(10) : 0',
  3210. PrintConv => '$val ? sprintf("%.2f m",$val) : "inf"',
  3211. PrintConvInv => '$val eq "inf" ? 0 : $val =~ s/\s*m$//, $val',
  3212. },
  3213. 0x0a => { #8/9
  3214. Name => 'FocalLength',
  3215. Priority => 0,
  3216. %nikonFocalConversions,
  3217. },
  3218. 0x0b => { #8
  3219. Name => 'LensIDNumber',
  3220. Notes => 'see LensID values below',
  3221. },
  3222. 0x0c => { #8
  3223. Name => 'LensFStops',
  3224. ValueConv => '$val / 12',
  3225. ValueConvInv => '$val * 12',
  3226. PrintConv => 'sprintf("%.2f", $val)',
  3227. PrintConvInv => '$val',
  3228. },
  3229. 0x0d => { #8/9
  3230. Name => 'MinFocalLength',
  3231. %nikonFocalConversions,
  3232. },
  3233. 0x0e => { #8/9
  3234. Name => 'MaxFocalLength',
  3235. %nikonFocalConversions,
  3236. },
  3237. 0x0f => { #8
  3238. Name => 'MaxApertureAtMinFocal',
  3239. %nikonApertureConversions,
  3240. },
  3241. 0x10 => { #8
  3242. Name => 'MaxApertureAtMaxFocal',
  3243. %nikonApertureConversions,
  3244. },
  3245. 0x11 => 'MCUVersion', #8
  3246. 0x12 => { #8
  3247. Name => 'EffectiveMaxAperture',
  3248. %nikonApertureConversions,
  3249. },
  3250. );
  3251. # Nikon lens data (note: needs decrypting)
  3252. %Image::ExifTool::Nikon::LensData0204 = (
  3253. %binaryDataAttrs,
  3254. NOTES => q{
  3255. Nikon encrypts the LensData information below if LensDataVersion is 0201 or
  3256. higher, but the decryption algorithm is known so the information can be
  3257. extracted.
  3258. },
  3259. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3260. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  3261. 0x00 => {
  3262. Name => 'LensDataVersion',
  3263. Format => 'string[4]',
  3264. Writable => 0,
  3265. },
  3266. 0x04 => { #8
  3267. Name => 'ExitPupilPosition',
  3268. ValueConv => '$val ? 2048 / $val : $val',
  3269. ValueConvInv => '$val ? 2048 / $val : $val',
  3270. PrintConv => 'sprintf("%.1f mm",$val)',
  3271. PrintConvInv => '$val=~s/\s*mm$//; $val',
  3272. },
  3273. 0x05 => { #8
  3274. Name => 'AFAperture',
  3275. %nikonApertureConversions,
  3276. },
  3277. 0x08 => { #8
  3278. # this seems to be 2 values: the upper nibble gives the far focus
  3279. # range and the lower nibble gives the near focus range. The values
  3280. # are in the range 1-N, where N is lens-dependent. A value of 0 for
  3281. # the far focus range indicates infinity. (ref JD)
  3282. Name => 'FocusPosition',
  3283. PrintConv => 'sprintf("0x%02x", $val)',
  3284. PrintConvInv => '$val',
  3285. },
  3286. # --> extra byte at position 0x09 in this version of LensData (PH)
  3287. 0x0a => { #8/9
  3288. # With older AF lenses this does not work... (ref 13)
  3289. # eg) AF Nikkor 50mm f/1.4 => 48 (0x30)
  3290. # AF Zoom-Nikkor 35-105mm f/3.5-4.5 => @35mm => 15 (0x0f), @105mm => 141 (0x8d)
  3291. Notes => 'this focus distance is approximate, and not very accurate for some lenses',
  3292. Name => 'FocusDistance',
  3293. ValueConv => '0.01 * 10**($val/40)', # in m
  3294. ValueConvInv => '$val>0 ? 40*log($val*100)/log(10) : 0',
  3295. PrintConv => '$val ? sprintf("%.2f m",$val) : "inf"',
  3296. PrintConvInv => '$val eq "inf" ? 0 : $val =~ s/\s*m$//, $val',
  3297. },
  3298. 0x0b => { #8/9
  3299. Name => 'FocalLength',
  3300. Priority => 0,
  3301. %nikonFocalConversions,
  3302. },
  3303. 0x0c => { #8
  3304. Name => 'LensIDNumber',
  3305. Notes => 'see LensID values below',
  3306. },
  3307. 0x0d => { #8
  3308. Name => 'LensFStops',
  3309. ValueConv => '$val / 12',
  3310. ValueConvInv => '$val * 12',
  3311. PrintConv => 'sprintf("%.2f", $val)',
  3312. PrintConvInv => '$val',
  3313. },
  3314. 0x0e => { #8/9
  3315. Name => 'MinFocalLength',
  3316. %nikonFocalConversions,
  3317. },
  3318. 0x0f => { #8/9
  3319. Name => 'MaxFocalLength',
  3320. %nikonFocalConversions,
  3321. },
  3322. 0x10 => { #8
  3323. Name => 'MaxApertureAtMinFocal',
  3324. %nikonApertureConversions,
  3325. },
  3326. 0x11 => { #8
  3327. Name => 'MaxApertureAtMaxFocal',
  3328. %nikonApertureConversions,
  3329. },
  3330. 0x12 => 'MCUVersion', #8
  3331. 0x13 => { #8
  3332. Name => 'EffectiveMaxAperture',
  3333. %nikonApertureConversions,
  3334. },
  3335. );
  3336. # Nikon lens data version 0400 (note: needs decrypting) (ref PH)
  3337. %Image::ExifTool::Nikon::LensData0400 = (
  3338. %binaryDataAttrs,
  3339. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3340. NOTES => 'Tags extracted from the encrypted lens data of Nikon 1 models.',
  3341. 0x00 => {
  3342. Name => 'LensDataVersion',
  3343. Format => 'string[4]',
  3344. Writable => 0,
  3345. },
  3346. 0x18a => { #PH
  3347. Name => 'LensModel',
  3348. Format => 'string[64]',
  3349. },
  3350. );
  3351. # Unknown Nikon lens data (note: data may need decrypting after byte 4)
  3352. %Image::ExifTool::Nikon::LensDataUnknown = (
  3353. PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
  3354. FIRST_ENTRY => 0,
  3355. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3356. 0x00 => {
  3357. Name => 'LensDataVersion',
  3358. Format => 'string[4]',
  3359. },
  3360. );
  3361. # shot information (encrypted in some cameras) - ref 18
  3362. %Image::ExifTool::Nikon::ShotInfo = (
  3363. %binaryDataAttrs,
  3364. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3365. DATAMEMBER => [ 0 ],
  3366. NOTES => q{
  3367. This information is encrypted for ShotInfoVersion 02xx, and some tags are
  3368. only valid for specific models.
  3369. },
  3370. 0x00 => {
  3371. Name => 'ShotInfoVersion',
  3372. Format => 'string[4]',
  3373. Writable => 0,
  3374. RawConv => '$$self{ShotInfoVersion} = $val; $val =~ /^\d+$/ ? $val : undef',
  3375. },
  3376. 0x04 => {
  3377. Name => 'FirmwareVersion',
  3378. Format => 'string[5]',
  3379. Writable => 0,
  3380. RawConv => '$val =~ /^\d\.\d+.$/ ? $val : undef',
  3381. },
  3382. 0x10 => {
  3383. Name => 'DistortionControl',
  3384. Condition => '$$self{Model} =~ /P6000\b/',
  3385. Notes => 'P6000',
  3386. PrintConv => \%offOn,
  3387. },
  3388. 0x66 => {
  3389. Name => 'VR_0x66',
  3390. Condition => '$$self{ShotInfoVersion} eq "0204"',
  3391. Format => 'int8u',
  3392. Unknown => 1,
  3393. Notes => 'D2X, D2Xs (unverified)',
  3394. PrintConv => {
  3395. 0 => 'Off',
  3396. 1 => 'On (normal)',
  3397. 2 => 'On (active)',
  3398. },
  3399. },
  3400. # 6a, 6e not correct for 0103 (D70), 0207 (D200)
  3401. 0x6a => {
  3402. Name => 'ShutterCount',
  3403. Condition => '$$self{ShotInfoVersion} eq "0204"',
  3404. Format => 'int32u',
  3405. Priority => 0,
  3406. Notes => 'D2X, D2Xs',
  3407. },
  3408. 0x6e => {
  3409. Name => 'DeletedImageCount',
  3410. Condition => '$$self{ShotInfoVersion} eq "0204"',
  3411. Format => 'int32u',
  3412. Priority => 0,
  3413. Notes => 'D2X, D2Xs',
  3414. },
  3415. 0x75 => { #JD
  3416. Name => 'VibrationReduction',
  3417. Condition => '$$self{ShotInfoVersion} eq "0207"',
  3418. Format => 'int8u',
  3419. Notes => 'D200',
  3420. PrintConv => {
  3421. 0 => 'Off',
  3422. # (not sure what the different values represent, but values
  3423. # of 1 and 2 have even been observed for non-VR lenses!)
  3424. 1 => 'On (1)', #PH
  3425. 2 => 'On (2)', #PH
  3426. 3 => 'On (3)', #PH (rare -- only seen once)
  3427. },
  3428. },
  3429. 0x82 => { # educated guess, needs verification
  3430. Name => 'VibrationReduction',
  3431. Condition => '$$self{ShotInfoVersion} eq "0204"',
  3432. Format => 'int8u',
  3433. Notes => 'D2X, D2Xs',
  3434. PrintConv => {
  3435. 0 => 'Off',
  3436. 1 => 'On',
  3437. },
  3438. },
  3439. 0x157 => { #JD
  3440. Name => 'ShutterCount',
  3441. Condition => '$$self{ShotInfoVersion} eq "0205"',
  3442. Format => 'undef[2]',
  3443. Priority => 0,
  3444. Notes => 'D50',
  3445. # treat as a 2-byte big-endian integer
  3446. ValueConv => 'unpack("n", $val)',
  3447. ValueConvInv => 'pack("n",$val)',
  3448. },
  3449. 0x1ae => { #JD
  3450. Name => 'VibrationReduction',
  3451. Condition => '$$self{ShotInfoVersion} eq "0205"',
  3452. Format => 'int8u',
  3453. Notes => 'D50',
  3454. PrintHex => 1,
  3455. PrintConv => {
  3456. 0x00 => 'n/a',
  3457. 0x0c => 'Off',
  3458. 0x0f => 'On',
  3459. },
  3460. },
  3461. 0x24d => { #PH
  3462. Name => 'ShutterCount',
  3463. Condition => '$$self{ShotInfoVersion} eq "0211"',
  3464. Notes => 'D60',
  3465. Format => 'int32u',
  3466. Priority => 0,
  3467. },
  3468. # note: DecryptLen currently set to 0x251
  3469. );
  3470. # shot information for D40 and D40X (encrypted) - ref PH
  3471. %Image::ExifTool::Nikon::ShotInfoD40 = (
  3472. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3473. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3474. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3475. VARS => { ID_LABEL => 'Index' },
  3476. IS_SUBDIR => [ 729 ],
  3477. WRITABLE => 1,
  3478. FIRST_ENTRY => 0,
  3479. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3480. NOTES => 'These tags are extracted from encrypted data in D40 and D40X images.',
  3481. 0x00 => {
  3482. Name => 'ShotInfoVersion',
  3483. Format => 'string[4]',
  3484. Writable => 0,
  3485. },
  3486. 582 => {
  3487. Name => 'ShutterCount',
  3488. Format => 'int32u',
  3489. Priority => 0,
  3490. },
  3491. 586.1 => { #JD
  3492. Name => 'VibrationReduction',
  3493. Mask => 0x08,
  3494. PrintConv => {
  3495. 0x00 => 'Off',
  3496. 0x08 => 'On',
  3497. },
  3498. },
  3499. 729 => { #JD
  3500. Name => 'CustomSettingsD40',
  3501. Format => 'undef[12]',
  3502. SubDirectory => {
  3503. TagTable => 'Image::ExifTool::NikonCustom::SettingsD40',
  3504. },
  3505. },
  3506. # note: DecryptLen currently set to 748
  3507. );
  3508. # shot information for D80 (encrypted) - ref JD
  3509. %Image::ExifTool::Nikon::ShotInfoD80 = (
  3510. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3511. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3512. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3513. VARS => { ID_LABEL => 'Index' },
  3514. IS_SUBDIR => [ 748 ],
  3515. WRITABLE => 1,
  3516. FIRST_ENTRY => 0,
  3517. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3518. NOTES => 'These tags are extracted from encrypted data in D80 images.',
  3519. 0x00 => {
  3520. Name => 'ShotInfoVersion',
  3521. Format => 'string[4]',
  3522. Writable => 0,
  3523. },
  3524. 586 => {
  3525. Name => 'ShutterCount',
  3526. Format => 'int32u',
  3527. Priority => 0,
  3528. },
  3529. # split 590 into a few different tags
  3530. 590.1 => {
  3531. Name => 'Rotation',
  3532. Mask => 0x07,
  3533. PrintConv => {
  3534. 0x00 => 'Horizontal',
  3535. 0x01 => 'Rotated 270 CW',
  3536. 0x02 => 'Rotated 90 CW',
  3537. 0x03 => 'Rotated 180',
  3538. },
  3539. },
  3540. 590.2 => {
  3541. Name => 'VibrationReduction',
  3542. Mask => 0x18,
  3543. PrintConv => {
  3544. 0x00 => 'Off',
  3545. 0x18 => 'On',
  3546. },
  3547. },
  3548. 590.3 => {
  3549. Name => 'FlashFired',
  3550. Mask => 0xe0,
  3551. PrintConv => { BITMASK => {
  3552. 6 => 'Internal',
  3553. 7 => 'External',
  3554. }},
  3555. },
  3556. 708 => {
  3557. Name => 'NikonImageSize',
  3558. Mask => 0xf0,
  3559. PrintConv => {
  3560. 0x00 => 'Large (10.0 M)',
  3561. 0x10 => 'Medium (5.6 M)',
  3562. 0x20 => 'Small (2.5 M)',
  3563. },
  3564. },
  3565. 708.1 => {
  3566. Name => 'ImageQuality',
  3567. Mask => 0x0f,
  3568. PrintConv => {
  3569. 0 => 'NEF (RAW)',
  3570. 1 => 'JPEG Fine',
  3571. 2 => 'JPEG Normal',
  3572. 3 => 'JPEG Basic',
  3573. 4 => 'NEF (RAW) + JPEG Fine',
  3574. 5 => 'NEF (RAW) + JPEG Normal',
  3575. 6 => 'NEF (RAW) + JPEG Basic',
  3576. },
  3577. },
  3578. 748 => { #JD
  3579. Name => 'CustomSettingsD80',
  3580. Format => 'undef[17]',
  3581. SubDirectory => {
  3582. TagTable => 'Image::ExifTool::NikonCustom::SettingsD80',
  3583. },
  3584. },
  3585. # note: DecryptLen currently set to 764
  3586. );
  3587. # shot information for D90 (encrypted) - ref PH
  3588. %Image::ExifTool::Nikon::ShotInfoD90 = (
  3589. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3590. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3591. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3592. VARS => { ID_LABEL => 'Index' },
  3593. IS_SUBDIR => [ 0x374 ],
  3594. WRITABLE => 1,
  3595. FIRST_ENTRY => 0,
  3596. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3597. NOTES => q{
  3598. These tags are extracted from encrypted data in images from the D90 with
  3599. firmware 1.00.
  3600. },
  3601. 0x00 => {
  3602. Name => 'ShotInfoVersion',
  3603. Format => 'string[4]',
  3604. Writable => 0,
  3605. },
  3606. 0x04 => {
  3607. Name => 'FirmwareVersion',
  3608. Format => 'string[5]',
  3609. Writable => 0,
  3610. },
  3611. 0x2b5 => { #JD (same value found at offset 0x39, 0x2bf, 0x346)
  3612. Name => 'ISO2',
  3613. ValueConv => '100*exp(($val/12-5)*log(2))',
  3614. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  3615. PrintConv => 'int($val + 0.5)',
  3616. PrintConvInv => '$val',
  3617. },
  3618. 0x2d5 => {
  3619. Name => 'ShutterCount',
  3620. Format => 'int32u',
  3621. Priority => 0,
  3622. },
  3623. 0x374 => {
  3624. Name => 'CustomSettingsD90',
  3625. Format => 'undef[36]',
  3626. SubDirectory => {
  3627. TagTable => 'Image::ExifTool::NikonCustom::SettingsD90',
  3628. },
  3629. },
  3630. # note: DecryptLen currently set to 0x398
  3631. );
  3632. # shot information for the D3 firmware 0.37 and 1.00 (encrypted) - ref PH
  3633. %Image::ExifTool::Nikon::ShotInfoD3a = (
  3634. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3635. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3636. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3637. VARS => { ID_LABEL => 'Index' },
  3638. IS_SUBDIR => [ 0x301 ],
  3639. WRITABLE => 1,
  3640. FIRST_ENTRY => 0,
  3641. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3642. NOTES => q{
  3643. These tags are extracted from encrypted data in images from the D3 with
  3644. firmware 1.00 and earlier.
  3645. },
  3646. 0x00 => {
  3647. Name => 'ShotInfoVersion',
  3648. Format => 'string[4]',
  3649. Writable => 0,
  3650. },
  3651. 0x256 => { #JD (same value found at offset 0x26b)
  3652. Name => 'ISO2',
  3653. ValueConv => '100*exp(($val/12-5)*log(2))',
  3654. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  3655. PrintConv => 'int($val + 0.5)',
  3656. PrintConvInv => '$val',
  3657. },
  3658. 0x276 => { #JD
  3659. Name => 'ShutterCount',
  3660. Format => 'int32u',
  3661. Priority => 0,
  3662. },
  3663. 723.1 => {
  3664. Name => 'NikonImageSize',
  3665. Mask => 0x18,
  3666. PrintConv => {
  3667. 0x00 => 'Large',
  3668. 0x08 => 'Medium',
  3669. 0x10 => 'Small',
  3670. },
  3671. },
  3672. 723.2 => {
  3673. Name => 'ImageQuality',
  3674. Mask => 0x07,
  3675. PrintConv => {
  3676. 0 => 'NEF (RAW) + JPEG Fine',
  3677. 1 => 'NEF (RAW) + JPEG Norm',
  3678. 2 => 'NEF (RAW) + JPEG Basic',
  3679. 3 => 'NEF (RAW)',
  3680. 4 => 'TIF (RGB)',
  3681. 5 => 'JPEG Fine',
  3682. 6 => 'JPEG Normal',
  3683. 7 => 'JPEG Basic',
  3684. },
  3685. },
  3686. 0x301 => { #(NC)
  3687. Name => 'CustomSettingsD3',
  3688. Format => 'undef[24]',
  3689. SubDirectory => {
  3690. TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
  3691. },
  3692. },
  3693. # note: DecryptLen currently set to 0x318
  3694. );
  3695. # shot information for the D3 firmware 1.10, 2.00 and 2.01 (encrypted) - ref PH
  3696. %Image::ExifTool::Nikon::ShotInfoD3b = (
  3697. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3698. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3699. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3700. VARS => { ID_LABEL => 'Index' },
  3701. IS_SUBDIR => [ 0x30a ],
  3702. WRITABLE => 1,
  3703. FIRST_ENTRY => 0,
  3704. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3705. DATAMEMBER => [ 4 ],
  3706. NOTES => q{
  3707. These tags are extracted from encrypted data in images from the D3 with
  3708. firmware 1.10, 2.00, 2.01 and 2.02.
  3709. },
  3710. 0x00 => {
  3711. Name => 'ShotInfoVersion',
  3712. Format => 'string[4]',
  3713. Writable => 0,
  3714. },
  3715. 0x04 => {
  3716. Name => 'FirmwareVersion',
  3717. Format => 'string[5]',
  3718. Writable => 0,
  3719. RawConv => '$$self{FirmwareVersion} = $val',
  3720. },
  3721. 0x10 => { #28
  3722. Name => 'ImageArea',
  3723. PrintConv => {
  3724. 0 => 'FX (36.0 x 23.9 mm)',
  3725. 1 => 'DX (23.5 x 15.6 mm)',
  3726. 2 => '5:4 (30.0 x 23.9 mm)',
  3727. },
  3728. },
  3729. 0x25d => {
  3730. Name => 'ISO2',
  3731. ValueConv => '100*exp(($val/12-5)*log(2))',
  3732. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  3733. PrintConv => 'int($val + 0.5)',
  3734. PrintConvInv => '$val',
  3735. },
  3736. 0x27d => {
  3737. Name => 'ShutterCount',
  3738. Condition => '$$self{FirmwareVersion} =~ /^1.01/',
  3739. Notes => 'firmware 1.10',
  3740. Format => 'int32u',
  3741. Priority => 0,
  3742. },
  3743. 0x27f => {
  3744. Name => 'ShutterCount',
  3745. Condition => '$$self{FirmwareVersion} =~ /^2.0/',
  3746. Notes => 'firmware 2.00, 2.01 and 2.02',
  3747. Format => 'int32u',
  3748. Priority => 0,
  3749. },
  3750. 732.1 => { #28
  3751. Name => 'NikonImageSize',
  3752. Mask => 0x18,
  3753. PrintConv => {
  3754. 0x00 => 'Large',
  3755. 0x08 => 'Medium',
  3756. 0x10 => 'Small',
  3757. },
  3758. },
  3759. 732.2 => { #28
  3760. Name => 'ImageQuality',
  3761. Mask => 0x07,
  3762. PrintConv => {
  3763. 0 => 'NEF (RAW) + JPEG Fine',
  3764. 1 => 'NEF (RAW) + JPEG Norm',
  3765. 2 => 'NEF (RAW) + JPEG Basic',
  3766. 3 => 'NEF (RAW)',
  3767. 4 => 'TIF (RGB)',
  3768. 5 => 'JPEG Fine',
  3769. 6 => 'JPEG Normal',
  3770. 7 => 'JPEG Basic',
  3771. },
  3772. },
  3773. 0x28a => { #28
  3774. Name => 'PreFlashReturnStrength',
  3775. Notes => 'valid in TTL and TTL-BL flash control modes',
  3776. # this is used to set the flash power using this relationship
  3777. # for the SB-800 and SB-900:
  3778. # $val < 140 ? 2**(0.08372*$val-12.352) : $val
  3779. },
  3780. 0x30a => { # tested with firmware 2.00
  3781. Name => 'CustomSettingsD3',
  3782. Format => 'undef[24]',
  3783. SubDirectory => {
  3784. TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
  3785. },
  3786. },
  3787. # note: DecryptLen currently set to 0x321
  3788. );
  3789. # shot information for the D3X firmware 1.00 (encrypted) - ref PH
  3790. %Image::ExifTool::Nikon::ShotInfoD3X = (
  3791. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3792. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3793. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3794. VARS => { ID_LABEL => 'Index' },
  3795. IS_SUBDIR => [ 0x30b ],
  3796. WRITABLE => 1,
  3797. FIRST_ENTRY => 0,
  3798. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3799. NOTES => q{
  3800. These tags are extracted from encrypted data in images from the D3X with
  3801. firmware 1.00.
  3802. },
  3803. 0x00 => {
  3804. Name => 'ShotInfoVersion',
  3805. Format => 'string[4]',
  3806. Writable => 0,
  3807. },
  3808. 0x04 => {
  3809. Name => 'FirmwareVersion',
  3810. Format => 'string[5]',
  3811. Writable => 0,
  3812. },
  3813. 0x25d => {
  3814. Name => 'ISO2',
  3815. ValueConv => '100*exp(($val/12-5)*log(2))',
  3816. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  3817. PrintConv => 'int($val + 0.5)',
  3818. PrintConvInv => '$val',
  3819. },
  3820. 0x280 => {
  3821. Name => 'ShutterCount',
  3822. Format => 'int32u',
  3823. Priority => 0,
  3824. },
  3825. 0x30b => { #(NC)
  3826. Name => 'CustomSettingsD3X',
  3827. Format => 'undef[24]',
  3828. SubDirectory => {
  3829. TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
  3830. },
  3831. },
  3832. # note: DecryptLen currently set to 0x323
  3833. );
  3834. # shot information for the D3S firmware 0.16 and 1.00 (encrypted) - ref PH
  3835. %Image::ExifTool::Nikon::ShotInfoD3S = (
  3836. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3837. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3838. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3839. VARS => { ID_LABEL => 'Index' },
  3840. IS_SUBDIR => [ 0x2ce ],
  3841. WRITABLE => 1,
  3842. FIRST_ENTRY => 0,
  3843. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3844. NOTES => q{
  3845. These tags are extracted from encrypted data in images from the D3S with
  3846. firmware 1.00 and earlier.
  3847. },
  3848. 0x00 => {
  3849. Name => 'ShotInfoVersion',
  3850. Format => 'string[4]',
  3851. Writable => 0,
  3852. },
  3853. 0x04 => {
  3854. Name => 'FirmwareVersion',
  3855. Format => 'string[5]',
  3856. Writable => 0,
  3857. },
  3858. 0x10 => { #28
  3859. Name => 'ImageArea',
  3860. PrintConv => {
  3861. 0 => 'FX (36x24)',
  3862. 1 => 'DX (24x16)',
  3863. 2 => '5:4 (30x24)',
  3864. 3 => '1.2x (30x20)',
  3865. },
  3866. },
  3867. 0x221 => {
  3868. Name => 'ISO2',
  3869. ValueConv => '100*exp(($val/12-5)*log(2))',
  3870. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  3871. PrintConv => 'int($val + 0.5)',
  3872. PrintConvInv => '$val',
  3873. },
  3874. 0x242 => {
  3875. Name => 'ShutterCount',
  3876. Format => 'int32u',
  3877. Priority => 0,
  3878. },
  3879. 0x2ce => { #(NC)
  3880. Name => 'CustomSettingsD3S',
  3881. Format => 'undef[27]',
  3882. SubDirectory => {
  3883. TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
  3884. },
  3885. },
  3886. # note: DecryptLen currently set to 0x2e9
  3887. );
  3888. # shot information for the D300 firmware 1.00 (encrypted) - ref JD
  3889. %Image::ExifTool::Nikon::ShotInfoD300a = (
  3890. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3891. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3892. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3893. VARS => { ID_LABEL => 'Index' },
  3894. IS_SUBDIR => [ 790 ],
  3895. WRITABLE => 1,
  3896. FIRST_ENTRY => 0,
  3897. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3898. NOTES => q{
  3899. These tags are extracted from encrypted data in images from the D300 with
  3900. firmware 1.00 and earlier.
  3901. },
  3902. 0x00 => {
  3903. Name => 'ShotInfoVersion',
  3904. Format => 'string[4]',
  3905. Writable => 0,
  3906. },
  3907. 604 => {
  3908. Name => 'ISO2',
  3909. ValueConv => '100*exp(($val/12-5)*log(2))',
  3910. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  3911. PrintConv => 'int($val + 0.5)',
  3912. PrintConvInv => '$val',
  3913. },
  3914. 633 => {
  3915. Name => 'ShutterCount',
  3916. Format => 'int32u',
  3917. Priority => 0,
  3918. },
  3919. 721 => { #PH
  3920. Name => 'AFFineTuneAdj',
  3921. Format => 'int16u',
  3922. PrintHex => 1,
  3923. PrintConvColumns => 3,
  3924. # thanks to Neil Nappe for the samples to decode this!...
  3925. # (have seen various unknown values here when flash is enabled, but
  3926. # these are yet to be decoded: 0x2e,0x619,0xd0d,0x103a,0x2029 - PH)
  3927. PrintConv => {
  3928. 0x403e => '+20',
  3929. 0x303e => '+19',
  3930. 0x203e => '+18',
  3931. 0x103e => '+17',
  3932. 0x003e => '+16',
  3933. 0xe03d => '+15',
  3934. 0xc03d => '+14',
  3935. 0xa03d => '+13',
  3936. 0x803d => '+12',
  3937. 0x603d => '+11',
  3938. 0x403d => '+10',
  3939. 0x203d => '+9',
  3940. 0x003d => '+8',
  3941. 0xc03c => '+7',
  3942. 0x803c => '+6',
  3943. 0x403c => '+5',
  3944. 0x003c => '+4',
  3945. 0x803b => '+3',
  3946. 0x003b => '+2',
  3947. 0x003a => '+1',
  3948. 0x0000 => '0',
  3949. 0x00c6 => '-1',
  3950. 0x00c5 => '-2',
  3951. 0x80c5 => '-3',
  3952. 0x00c4 => '-4',
  3953. 0x40c4 => '-5',
  3954. 0x80c4 => '-6',
  3955. 0xc0c4 => '-7',
  3956. 0x00c3 => '-8',
  3957. 0x20c3 => '-9',
  3958. 0x40c3 => '-10',
  3959. 0x60c3 => '-11',
  3960. 0x80c3 => '-12',
  3961. 0xa0c3 => '-13',
  3962. 0xc0c3 => '-14',
  3963. 0xe0c3 => '-15',
  3964. 0x00c2 => '-16',
  3965. 0x10c2 => '-17',
  3966. 0x20c2 => '-18',
  3967. 0x30c2 => '-19',
  3968. 0x40c2 => '-20',
  3969. },
  3970. },
  3971. 790 => {
  3972. Name => 'CustomSettingsD300',
  3973. Format => 'undef[24]',
  3974. SubDirectory => {
  3975. TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
  3976. },
  3977. },
  3978. # note: DecryptLen currently set to 813
  3979. );
  3980. # shot information for the D300 firmware 1.10 (encrypted) - ref PH
  3981. %Image::ExifTool::Nikon::ShotInfoD300b = (
  3982. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3983. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  3984. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  3985. VARS => { ID_LABEL => 'Index' },
  3986. DATAMEMBER => [ 4 ],
  3987. IS_SUBDIR => [ 802 ],
  3988. WRITABLE => 1,
  3989. FIRST_ENTRY => 0,
  3990. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3991. NOTES => q{
  3992. These tags are extracted from encrypted data in images from the D300 with
  3993. firmware 1.10.
  3994. },
  3995. 0x00 => {
  3996. Name => 'ShotInfoVersion',
  3997. Format => 'string[4]',
  3998. Writable => 0,
  3999. },
  4000. 0x04 => { #PH
  4001. Name => 'FirmwareVersion',
  4002. DataMember => 'FirmwareVersion',
  4003. Format => 'string[5]',
  4004. Writable => 0,
  4005. RawConv => '$$self{FirmwareVersion} = $val',
  4006. },
  4007. 613 => {
  4008. Name => 'ISO2',
  4009. ValueConv => '100*exp(($val/12-5)*log(2))',
  4010. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  4011. PrintConv => 'int($val + 0.5)',
  4012. PrintConvInv => '$val',
  4013. },
  4014. 644 => {
  4015. Name => 'ShutterCount',
  4016. Format => 'int32u',
  4017. Priority => 0,
  4018. },
  4019. 732 => [{
  4020. Name => 'AFFineTuneAdj',
  4021. Condition => '$$self{FirmwareVersion} eq "1.10B"',
  4022. Notes => 'firmware version 1.10B',
  4023. Format => 'int16u',
  4024. PrintHex => 1,
  4025. PrintConvColumns => 3,
  4026. # thanks to Michael Tapes for the samples to decode this!...
  4027. PrintConv => {
  4028. 0xe03e => '+20',
  4029. 0xc83e => '+19',
  4030. 0xb03e => '+18',
  4031. 0x983e => '+17',
  4032. 0x803e => '+16',
  4033. 0x683e => '+15',
  4034. 0x503e => '+14',
  4035. 0x383e => '+13',
  4036. 0x203e => '+12',
  4037. 0x083e => '+11',
  4038. 0xe03d => '+10',
  4039. 0xb03d => '+9',
  4040. 0x803d => '+8',
  4041. 0x503d => '+7',
  4042. 0x203d => '+6',
  4043. 0xe03c => '+5',
  4044. 0x803c => '+4',
  4045. 0x203c => '+3',
  4046. 0x803b => '+2',
  4047. 0x803a => '+1',
  4048. 0x0000 => '0',
  4049. 0x80c6 => '-1',
  4050. 0x80c5 => '-2',
  4051. 0x20c4 => '-3',
  4052. 0x80c4 => '-4',
  4053. 0xe0c4 => '-5',
  4054. 0x20c3 => '-6',
  4055. 0x50c3 => '-7',
  4056. 0x80c3 => '-8',
  4057. 0xb0c3 => '-9',
  4058. 0xe0c3 => '-10',
  4059. 0x08c2 => '-11',
  4060. 0x20c2 => '-12',
  4061. 0x38c2 => '-13',
  4062. 0x50c2 => '-14',
  4063. 0x68c2 => '-15',
  4064. 0x80c2 => '-16',
  4065. 0x98c2 => '-17',
  4066. 0xb0c2 => '-18',
  4067. 0xc8c2 => '-19',
  4068. 0xe0c2 => '-20',
  4069. },
  4070. },{
  4071. Name => 'AFFineTuneAdj',
  4072. Notes => 'other versions',
  4073. Format => 'int16u',
  4074. PrintHex => 1,
  4075. PrintConvColumns => 3,
  4076. # thanks to Stuart Solomon for the samples to decode this!...
  4077. PrintConv => {
  4078. 0x903e => '+20',
  4079. 0x7c3e => '+19',
  4080. 0x683e => '+18',
  4081. 0x543e => '+17',
  4082. 0x403e => '+16',
  4083. 0x2c3e => '+15',
  4084. 0x183e => '+14',
  4085. 0x043e => '+13',
  4086. 0xe03d => '+12',
  4087. 0xb83d => '+11',
  4088. 0x903d => '+10',
  4089. 0x683d => '+9',
  4090. 0x403d => '+8',
  4091. 0x183d => '+7',
  4092. 0xe03c => '+6',
  4093. 0x903c => '+5',
  4094. 0x403c => '+4',
  4095. 0xe03b => '+3',
  4096. 0x403b => '+2',
  4097. 0x403a => '+1',
  4098. 0x0000 => '0',
  4099. 0x40c6 => '-1',
  4100. 0x40c5 => '-2',
  4101. 0xe0c5 => '-3',
  4102. 0x40c4 => '-4',
  4103. 0x90c4 => '-5',
  4104. 0xe0c4 => '-6',
  4105. 0x18c3 => '-7',
  4106. 0x40c3 => '-8',
  4107. 0x68c3 => '-9',
  4108. 0x90c3 => '-10',
  4109. 0xb8c3 => '-11',
  4110. 0xe0c3 => '-12',
  4111. 0x04c2 => '-13',
  4112. 0x18c2 => '-14',
  4113. 0x2cc2 => '-15',
  4114. 0x40c2 => '-16',
  4115. 0x54c2 => '-17',
  4116. 0x68c2 => '-18',
  4117. 0x7cc2 => '-19',
  4118. 0x90c2 => '-20',
  4119. },
  4120. }],
  4121. 802 => {
  4122. Name => 'CustomSettingsD300',
  4123. Format => 'undef[24]',
  4124. SubDirectory => {
  4125. TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
  4126. },
  4127. },
  4128. # note: DecryptLen currently set to 825
  4129. );
  4130. # shot information for the D300S firmware 1.00 (encrypted) - ref PH
  4131. %Image::ExifTool::Nikon::ShotInfoD300S = (
  4132. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4133. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4134. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4135. VARS => { ID_LABEL => 'Index' },
  4136. IS_SUBDIR => [ 804 ],
  4137. WRITABLE => 1,
  4138. FIRST_ENTRY => 0,
  4139. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4140. NOTES => q{
  4141. These tags are extracted from encrypted data in images from the D300S with
  4142. firmware 1.00.
  4143. },
  4144. 0x00 => {
  4145. Name => 'ShotInfoVersion',
  4146. Format => 'string[4]',
  4147. Writable => 0,
  4148. },
  4149. 0x04 => {
  4150. Name => 'FirmwareVersion',
  4151. Format => 'string[5]',
  4152. Writable => 0,
  4153. },
  4154. 613 => {
  4155. Name => 'ISO2',
  4156. ValueConv => '100*exp(($val/12-5)*log(2))',
  4157. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  4158. PrintConv => 'int($val + 0.5)',
  4159. PrintConvInv => '$val',
  4160. },
  4161. 646 => {
  4162. Name => 'ShutterCount',
  4163. Format => 'int32u',
  4164. Priority => 0,
  4165. },
  4166. 804 => { #(NC)
  4167. Name => 'CustomSettingsD300S',
  4168. Format => 'undef[24]',
  4169. SubDirectory => {
  4170. TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
  4171. },
  4172. },
  4173. # note: DecryptLen currently set to 827
  4174. );
  4175. # shot information for the D700 firmware 1.02f (encrypted) - ref 29
  4176. %Image::ExifTool::Nikon::ShotInfoD700 = (
  4177. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4178. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4179. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4180. VARS => { ID_LABEL => 'Index' },
  4181. IS_SUBDIR => [ 804 ],
  4182. WRITABLE => 1,
  4183. FIRST_ENTRY => 0,
  4184. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4185. NOTES => q{
  4186. These tags are extracted from encrypted data in images from the D700 with
  4187. firmware 1.02f.
  4188. },
  4189. 0x00 => {
  4190. Name => 'ShotInfoVersion',
  4191. Format => 'string[4]',
  4192. Writable => 0,
  4193. },
  4194. 0x04 => {
  4195. Name => 'FirmwareVersion',
  4196. Format => 'string[5]',
  4197. Writable => 0,
  4198. },
  4199. 613 => { # 0x265
  4200. Name => 'ISO2',
  4201. ValueConv => '100*exp(($val/12-5)*log(2))',
  4202. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  4203. PrintConv => 'int($val + 0.5)',
  4204. PrintConvInv => '$val',
  4205. },
  4206. 0x287 => {
  4207. Name => 'ShutterCount',
  4208. Format => 'int32u',
  4209. Priority => 0,
  4210. },
  4211. 804 => { # 0x324 (NC)
  4212. Name => 'CustomSettingsD700',
  4213. Format => 'undef[48]',
  4214. SubDirectory => {
  4215. TagTable => 'Image::ExifTool::NikonCustom::SettingsD700',
  4216. },
  4217. },
  4218. # note: DecryptLen currently set to 852
  4219. );
  4220. # shot information for the D5000 firmware 1.00 (encrypted) - ref PH
  4221. %Image::ExifTool::Nikon::ShotInfoD5000 = (
  4222. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4223. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4224. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4225. VARS => { ID_LABEL => 'Index' },
  4226. IS_SUBDIR => [ 0x378 ],
  4227. WRITABLE => 1,
  4228. FIRST_ENTRY => 0,
  4229. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4230. NOTES => q{
  4231. These tags are extracted from encrypted data in images from the D5000 with
  4232. firmware 1.00.
  4233. },
  4234. 0x00 => {
  4235. Name => 'ShotInfoVersion',
  4236. Format => 'string[4]',
  4237. Writable => 0,
  4238. },
  4239. 0x04 => {
  4240. Name => 'FirmwareVersion',
  4241. Format => 'string[5]',
  4242. Writable => 0,
  4243. },
  4244. 0x2b5 => { # (also found at 0x2c0)
  4245. Name => 'ISO2',
  4246. ValueConv => '100*exp(($val/12-5)*log(2))',
  4247. ValueConvInv => '(log($val/100)/log(2)+5)*12',
  4248. PrintConv => 'int($val + 0.5)',
  4249. PrintConvInv => '$val',
  4250. },
  4251. 0x2d6 => {
  4252. Name => 'ShutterCount',
  4253. Format => 'int32u',
  4254. Priority => 0,
  4255. },
  4256. 0x378 => {
  4257. Name => 'CustomSettingsD5000',
  4258. Format => 'undef[34]',
  4259. SubDirectory => {
  4260. TagTable => 'Image::ExifTool::NikonCustom::SettingsD5000',
  4261. },
  4262. },
  4263. # note: DecryptLen currently set to 0x39a
  4264. );
  4265. # shot information for the D5100 firmware 1.00f (encrypted) - ref PH
  4266. %Image::ExifTool::Nikon::ShotInfoD5100 = (
  4267. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4268. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4269. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4270. VARS => { ID_LABEL => 'Index' },
  4271. IS_SUBDIR => [ 0x407 ],
  4272. WRITABLE => 1,
  4273. FIRST_ENTRY => 0,
  4274. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4275. 0x00 => {
  4276. Name => 'ShotInfoVersion',
  4277. Format => 'string[4]',
  4278. Writable => 0,
  4279. },
  4280. 0x04 => {
  4281. Name => 'FirmwareVersion',
  4282. Format => 'string[5]',
  4283. Writable => 0,
  4284. },
  4285. 0x321 => {
  4286. Name => 'ShutterCount',
  4287. Format => 'int32u',
  4288. Priority => 0,
  4289. },
  4290. 0x407 => {
  4291. Name => 'CustomSettingsD5100',
  4292. Format => 'undef[34]',
  4293. SubDirectory => {
  4294. TagTable => 'Image::ExifTool::NikonCustom::SettingsD5100',
  4295. },
  4296. },
  4297. # note: DecryptLen currently set to 0x430
  4298. );
  4299. # shot information for the D5200 firmware 1.00 (encrypted) - ref PH
  4300. %Image::ExifTool::Nikon::ShotInfoD5200 = (
  4301. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4302. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4303. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4304. VARS => { ID_LABEL => 'Index' },
  4305. IS_SUBDIR => [ 0xcd5 ],
  4306. WRITABLE => 1,
  4307. FIRST_ENTRY => 0,
  4308. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4309. 0x00 => {
  4310. Name => 'ShotInfoVersion',
  4311. Format => 'string[4]',
  4312. Writable => 0,
  4313. },
  4314. 0x04 => {
  4315. Name => 'FirmwareVersion',
  4316. Format => 'string[5]',
  4317. Writable => 0,
  4318. },
  4319. # 0x101 - 2=VR Off, 3=VR On
  4320. # 0x13d - 0=VR On, 1=VR Off
  4321. 0xbd8 => {
  4322. Name => 'ShutterCount',
  4323. Format => 'int32u',
  4324. Priority => 0,
  4325. },
  4326. # 0xcd2 - 12=VR Off, 15=VR On
  4327. 0xcd5 => {
  4328. Name => 'CustomSettingsD5200',
  4329. Format => 'undef[34]',
  4330. SubDirectory => {
  4331. TagTable => 'Image::ExifTool::NikonCustom::SettingsD5200',
  4332. },
  4333. },
  4334. # note: DecryptLen currently set to 0xd00
  4335. );
  4336. # shot information for the D7000 firmware 1.01d (encrypted) - ref 29
  4337. %Image::ExifTool::Nikon::ShotInfoD7000 = (
  4338. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4339. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4340. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4341. VARS => { ID_LABEL => 'Index' },
  4342. IS_SUBDIR => [ 1028 ],
  4343. WRITABLE => 1,
  4344. FIRST_ENTRY => 0,
  4345. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4346. NOTES => q{
  4347. These tags are extracted from encrypted data in images from the D7000 with
  4348. firmware 1.01b.
  4349. },
  4350. 0x00 => {
  4351. Name => 'ShotInfoVersion',
  4352. Format => 'string[4]',
  4353. Writable => 0,
  4354. },
  4355. 0x04 => {
  4356. Name => 'FirmwareVersion',
  4357. Format => 'string[5]',
  4358. Writable => 0,
  4359. },
  4360. #613 => {
  4361. # Name => 'ISO2',
  4362. # ValueConv => '100*exp(($val/12-5)*log(2))',
  4363. # ValueConvInv => '(log($val/100)/log(2)+5)*12',
  4364. # PrintConv => 'int($val + 0.5)',
  4365. # PrintConvInv => '$val',
  4366. #},
  4367. 0x320 => { # 800
  4368. Name => 'ShutterCount',
  4369. Format => 'int32u',
  4370. Priority => 0,
  4371. },
  4372. 0x404 => { # 1028 (NC)
  4373. Name => 'CustomSettingsD7000',
  4374. Format => 'undef[48]',
  4375. SubDirectory => {
  4376. TagTable => 'Image::ExifTool::NikonCustom::SettingsD7000',
  4377. },
  4378. },
  4379. );
  4380. # shot information for the D800 firmware 1.01a (encrypted) - ref PH
  4381. %Image::ExifTool::Nikon::ShotInfoD800 = (
  4382. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4383. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4384. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4385. VARS => { ID_LABEL => 'Index' },
  4386. IS_SUBDIR => [ 0x6ec ],
  4387. WRITABLE => 1,
  4388. FIRST_ENTRY => 0,
  4389. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4390. NOTES => 'These tags are extracted from encrypted data in images from the D800.',
  4391. 0x00 => {
  4392. Name => 'ShotInfoVersion',
  4393. Format => 'string[4]',
  4394. Writable => 0,
  4395. },
  4396. 0x04 => {
  4397. Name => 'FirmwareVersion',
  4398. Format => 'string[5]',
  4399. Writable => 0,
  4400. },
  4401. 0x4c0 => {
  4402. Name => 'RepeatingFlashOutputExternal',
  4403. ValueConv => '2 ** (-$val/6)',
  4404. ValueConvInv => '$val > 0 ? -6*log($val)/log(2) : 0',
  4405. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  4406. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  4407. },
  4408. 0x4c2 => {
  4409. Name => 'RepeatingFlashRateExternal',
  4410. DelValue => 0,
  4411. RawConv => '$val || undef',
  4412. PrintConv => '"$val Hz"',
  4413. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  4414. },
  4415. 0x4c3 => {
  4416. Name => 'RepeatingFlashCountExternal',
  4417. DelValue => 0,
  4418. RawConv => '$val || undef',
  4419. },
  4420. 0x4d2 => {
  4421. Name => 'FlashExposureComp2',
  4422. Notes => 'includes the effect of flash bracketing',
  4423. Format => 'int8s',
  4424. ValueConv => '-$val/6',
  4425. ValueConvInv => '-6 * $val',
  4426. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  4427. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  4428. },
  4429. # 0x4d4 - FEC again, doesn't include bracketing this time (internal?)
  4430. # (not fully decoded, and duplicated in custom settings)
  4431. # 0x4d9 => {
  4432. # Name => 'FlashControlBuilt-in',
  4433. # PrintConv => {
  4434. # 1 => 'TTL',
  4435. # 6 => 'Manual',
  4436. # 7 => 'Repeating Flash',
  4437. # },
  4438. # },
  4439. 0x4da => {
  4440. Name => 'RepeatingFlashRateBuilt-in',
  4441. DelValue => 0,
  4442. RawConv => '$val || undef',
  4443. PrintConv => '"$val Hz"',
  4444. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  4445. },
  4446. 0x4db => {
  4447. Name => 'RepeatingFlashCountBuilt-in',
  4448. DelValue => 0,
  4449. RawConv => '$val || undef',
  4450. },
  4451. # 1294.1 => { # (0x4dc)
  4452. # Name => 'FlashModeBuilt-in',
  4453. # Mask => 0x0f,
  4454. # PrintConv => {
  4455. # 0 => 'Front-curtain Sync',
  4456. # 1 => 'Red-eye Reduction',
  4457. # 2 => 'Redy-eye Reduction with Slow Sync',
  4458. # 3 => 'Slow Sync',
  4459. # 4 => 'Rear-curtain Sync',
  4460. # 5 => 'Rear-curtain Sync 2', # got this in P exposure mode
  4461. # },
  4462. # },
  4463. # 1294.2 => { # (0x4dc)
  4464. # Name => 'ExposureMode2',
  4465. # Mask => 0xf0,
  4466. # PrintConv => {
  4467. # 0x00 => 'Program',
  4468. # 0x10 => 'Aperture Priority',
  4469. # 0x30 => 'Manual',
  4470. # },
  4471. # },
  4472. # 0x511 - related to FlashSyncSpeed
  4473. 0x51c => 'SequenceNumber',
  4474. # 0x4ba+0x63 - interesting
  4475. # 0x4ba+0x68 - general downward trend
  4476. # 0x4ba+0x7b - FlashControlBuilt-in: 8=TTL, 72=Manual
  4477. # (not reliable)
  4478. # 1346.1 => { # (0x542)
  4479. # Name => 'RepeatingFlashOutputBuilt-in',
  4480. # DelValue => 112,
  4481. # Mask => 0xfc,
  4482. # RawConv => '$val == 112 ? undef : 2 ** ($val/12-7)',
  4483. # ValueConvInv => '$val > 0 ? (log($val)/log(2)+7)*12 : 0',
  4484. # PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  4485. # PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  4486. # },
  4487. 0x5fb => {
  4488. Name => 'ShutterCount',
  4489. Format => 'int32u',
  4490. },
  4491. 0x6ec => {
  4492. Name => 'CustomSettingsD800',
  4493. Format => 'undef[48]',
  4494. SubDirectory => {
  4495. TagTable => 'Image::ExifTool::NikonCustom::SettingsD800',
  4496. },
  4497. },
  4498. # note: DecryptLen currently set to 0x720
  4499. );
  4500. # shot information for the D810 firmware 1.00(PH)/1.01 (encrypted) - ref 28
  4501. %Image::ExifTool::Nikon::ShotInfoD810 = (
  4502. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4503. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4504. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4505. VARS => { ID_LABEL => 'Index' },
  4506. DATAMEMBER => [ 0x40, 0x175e ],
  4507. IS_SUBDIR => [ 0x18ab ],
  4508. WRITABLE => 1,
  4509. FIRST_ENTRY => 0,
  4510. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4511. NOTES => 'These tags are extracted from encrypted data in images from the D810.',
  4512. 0x00 => {
  4513. Name => 'ShotInfoVersion',
  4514. Format => 'string[4]',
  4515. Writable => 0,
  4516. },
  4517. 0x04 => {
  4518. Name => 'FirmwareVersion',
  4519. Format => 'string[5]',
  4520. Writable => 0,
  4521. },
  4522. # 0x0c - number of entries in offset table (= 0x21)
  4523. # 0x10 - int32u[val 0x0c]: offset table
  4524. 0x40 => {
  4525. Name => 'CustomSettingsOffset', # (relative offset from start of ShotInfo data)
  4526. DataMember => 'CustomSettingsOffset',
  4527. Format => 'int32u',
  4528. Writable => 0,
  4529. RawConv => '$$self{CustomSettingsOffset} = $val',
  4530. },
  4531. 0x175e => {
  4532. Name => 'D810MeteringMode',
  4533. Mask => 0x03,
  4534. PrintConv => {
  4535. 0 => 'Matrix',
  4536. 1 => 'Center',
  4537. 2 => 'Spot',
  4538. 3 => 'Highlight'
  4539. },
  4540. Hook => '$varSize += $$self{CustomSettingsOffset} - 0x18ab',
  4541. },
  4542. 0x18ab => { # (actual offset adjusted by Hook above)
  4543. Name => 'CustomSettingsD810',
  4544. Notes => 'actual offset determined by CustomSettingsOffset',
  4545. Format => 'undef[53]',
  4546. SubDirectory => {
  4547. TagTable => 'Image::ExifTool::NikonCustom::SettingsD810',
  4548. },
  4549. },
  4550. # note: DecryptMore currently set to 53+4 bytes after CustomSettingsOffset
  4551. );
  4552. # shot information for the D4 firmware 1.00g (ref PH)
  4553. %Image::ExifTool::Nikon::ShotInfoD4 = (
  4554. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4555. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4556. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4557. VARS => { ID_LABEL => 'Index' },
  4558. IS_SUBDIR => [ 0x0751 ],
  4559. WRITABLE => 1,
  4560. FIRST_ENTRY => 0,
  4561. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4562. NOTES => q{
  4563. These tags are extracted from encrypted data in images from the D4.
  4564. },
  4565. 0x00 => {
  4566. Name => 'ShotInfoVersion',
  4567. Format => 'string[4]',
  4568. Writable => 0,
  4569. },
  4570. 0x04 => {
  4571. Name => 'FirmwareVersion',
  4572. Format => 'string[5]',
  4573. Writable => 0,
  4574. },
  4575. 0x0751 => { #PH (NC)
  4576. Name => 'CustomSettingsD4',
  4577. # (seems to work for 1.00g and 1.02b)
  4578. Format => 'undef[56]',
  4579. SubDirectory => { TagTable => 'Image::ExifTool::NikonCustom::SettingsD4' },
  4580. },
  4581. # note: DecryptLen currently set to 0x789
  4582. );
  4583. # shot information for the D4S firmware 1.01a (ref 28, encrypted)
  4584. %Image::ExifTool::Nikon::ShotInfoD4S = (
  4585. PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4586. WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
  4587. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  4588. VARS => { ID_LABEL => 'Index' },
  4589. DATAMEMBER => [ 4 ],
  4590. IS_SUBDIR => [ 0x189d, 0x193d ],
  4591. WRITABLE => 1,
  4592. FIRST_ENTRY => 0,
  4593. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4594. NOTES => q{
  4595. These tags are extracted from encrypted data in images from the D4S.
  4596. },
  4597. 0x00 => {
  4598. Name => 'ShotInfoVersion',
  4599. Format => 'string[4]',
  4600. Writable => 0,
  4601. },
  4602. 0x04 => {
  4603. Name => 'FirmwareVersion',
  4604. DataMember => 'FirmwareVersion',
  4605. Format => 'string[5]',
  4606. Writable => 0,
  4607. RawConv => '$$self{FirmwareVersion} = $val',
  4608. },
  4609. 0x189d => { #PH (NC)
  4610. Name => 'CustomSettingsD4S',
  4611. Condition => '$$self{FirmwareVersion} =~ /^1.00/',
  4612. Notes => 'firmware version 1.00',
  4613. Format => 'undef[56]',
  4614. SubDirectory => { TagTable => 'Image::ExifTool::NikonCustom::SettingsD4' },
  4615. },
  4616. 0x18c2 => { # CSf1-c (no idea why it is so far away from the rest of the settings)
  4617. Name => 'MultiSelectorLiveViewMode',
  4618. Groups => { 1 => 'NikonCustom' },
  4619. Condition => '$$self{FirmwareVersion} !~ /^1.00/',
  4620. Mask => 0xc0,
  4621. PrintConv => {
  4622. 0x00 => 'Reset',
  4623. 0x40 => 'Zoom',
  4624. 0xc0 => 'None',
  4625. },
  4626. },
  4627. 0x193d => {
  4628. Name => 'CustomSettingsD4S',
  4629. Condition => '$$self{FirmwareVersion} !~ /^1.00/',
  4630. Notes => 'firmware version 1.01',
  4631. Format => 'undef[56]',
  4632. SubDirectory => { TagTable => 'Image::ExifTool::NikonCustom::SettingsD4' },
  4633. },
  4634. 0x350b => {
  4635. Name => 'RollAngle',
  4636. Format => 'fixed32u',
  4637. Notes => 'converted to degrees of clockwise camera rotation',
  4638. ValueConv => '$val < 180 ? -$val : 360 - $val',
  4639. ValueConvInv => '$val <= 0 ? -$val : 360 - $val',
  4640. PrintConv => 'sprintf("%.1f", $val)',
  4641. PrintConvInv => '$val',
  4642. },
  4643. 0x350f => {
  4644. Name => 'PitchAngle',
  4645. Format => 'fixed32u',
  4646. Notes => 'converted to degrees of upward camera tilt',
  4647. ValueConv => '$val <= 180 ? $val : $val - 360',
  4648. ValueConvInv => '$val >= 0 ? $val : $val + 360',
  4649. PrintConv => 'sprintf("%.1f", $val)',
  4650. PrintConvInv => '$val',
  4651. },
  4652. 0x3513 => {
  4653. Name => 'YawAngle',
  4654. Format => 'fixed32u',
  4655. Notes => 'the camera pitch angle when shooting in portrait orientation',
  4656. ValueConv => '$val <= 180 ? $val : $val - 360',
  4657. ValueConvInv => '$val >= 0 ? $val : $val + 360',
  4658. PrintConv => 'sprintf("%.1f", $val)',
  4659. PrintConvInv => '$val',
  4660. },
  4661. # note: DecryptLen currently set to 0x3517
  4662. );
  4663. # Flash information (ref JD)
  4664. %Image::ExifTool::Nikon::FlashInfo0100 = (
  4665. %binaryDataAttrs,
  4666. DATAMEMBER => [ 9.2, 15, 16 ],
  4667. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4668. NOTES => q{
  4669. These tags are used by the D2H, D2Hs, D2X, D2Xs, D50, D70, D70s, D80 and
  4670. D200.
  4671. },
  4672. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  4673. 0 => {
  4674. Name => 'FlashInfoVersion',
  4675. Format => 'string[4]',
  4676. Writable => 0,
  4677. },
  4678. 4 => { #PH
  4679. Name => 'FlashSource',
  4680. PrintConv => {
  4681. 0 => 'None',
  4682. 1 => 'External',
  4683. 2 => 'Internal',
  4684. },
  4685. },
  4686. # 5 - values: 46,48,50,54,78
  4687. 6 => {
  4688. Format => 'int8u[2]',
  4689. Name => 'ExternalFlashFirmware',
  4690. SeparateTable => 'FlashFirmware',
  4691. PrintConv => \%flashFirmware,
  4692. },
  4693. 8 => {
  4694. Name => 'ExternalFlashFlags',
  4695. PrintConv => { 0 => '(none)',
  4696. BITMASK => {
  4697. 0 => 'Fired', #28
  4698. 2 => 'Bounce Flash', #PH
  4699. 4 => 'Wide Flash Adapter',
  4700. 5 => 'Dome Diffuser', #28
  4701. },
  4702. },
  4703. },
  4704. 9.1 => {
  4705. Name => 'FlashCommanderMode',
  4706. Mask => 0x80,
  4707. PrintConv => {
  4708. 0x00 => 'Off',
  4709. 0x80 => 'On',
  4710. },
  4711. },
  4712. 9.2 => {
  4713. Name => 'FlashControlMode',
  4714. Mask => 0x7f,
  4715. DataMember => 'FlashControlMode',
  4716. RawConv => '$$self{FlashControlMode} = $val',
  4717. PrintConv => \%flashControlMode,
  4718. SeparateTable => 'FlashControlMode',
  4719. },
  4720. 10 => [
  4721. {
  4722. Name => 'FlashOutput',
  4723. Condition => '$$self{FlashControlMode} >= 0x06',
  4724. ValueConv => '2 ** (-$val/6)',
  4725. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  4726. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  4727. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  4728. },
  4729. {
  4730. Name => 'FlashCompensation',
  4731. Format => 'int8s',
  4732. Priority => 0,
  4733. ValueConv => '-$val/6',
  4734. ValueConvInv => '-6 * $val',
  4735. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  4736. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  4737. },
  4738. ],
  4739. 11 => {
  4740. Name => 'FlashFocalLength',
  4741. RawConv => '$val ? $val : undef',
  4742. PrintConv => '"$val mm"',
  4743. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  4744. },
  4745. 12 => {
  4746. Name => 'RepeatingFlashRate',
  4747. RawConv => '$val ? $val : undef',
  4748. PrintConv => '"$val Hz"',
  4749. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  4750. },
  4751. 13 => {
  4752. Name => 'RepeatingFlashCount',
  4753. RawConv => '$val ? $val : undef',
  4754. },
  4755. 14 => { #PH
  4756. Name => 'FlashGNDistance',
  4757. SeparateTable => 1,
  4758. PrintConv => \%flashGNDistance,
  4759. },
  4760. 15 => {
  4761. Name => 'FlashGroupAControlMode',
  4762. Mask => 0x0f,
  4763. DataMember => 'FlashGroupAControlMode',
  4764. RawConv => '$$self{FlashGroupAControlMode} = $val',
  4765. PrintConv => \%flashControlMode,
  4766. SeparateTable => 'FlashControlMode',
  4767. },
  4768. 16 => {
  4769. Name => 'FlashGroupBControlMode',
  4770. Mask => 0x0f,
  4771. DataMember => 'FlashGroupBControlMode',
  4772. RawConv => '$$self{FlashGroupBControlMode} = $val',
  4773. PrintConv => \%flashControlMode,
  4774. SeparateTable => 'FlashControlMode',
  4775. },
  4776. 17 => [
  4777. {
  4778. Name => 'FlashGroupAOutput',
  4779. Condition => '$$self{FlashGroupAControlMode} >= 0x06',
  4780. ValueConv => '2 ** (-$val/6)',
  4781. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  4782. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  4783. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  4784. },
  4785. {
  4786. Name => 'FlashGroupACompensation',
  4787. Format => 'int8s',
  4788. ValueConv => '-$val/6',
  4789. ValueConvInv => '-6 * $val',
  4790. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  4791. PrintConvInv => '$val',
  4792. },
  4793. ],
  4794. 18 => [
  4795. {
  4796. Name => 'FlashGroupBOutput',
  4797. Condition => '$$self{FlashGroupBControlMode} >= 0x06',
  4798. ValueConv => '2 ** (-$val/6)',
  4799. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  4800. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  4801. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  4802. },
  4803. {
  4804. Name => 'FlashGroupBCompensation',
  4805. Format => 'int8s',
  4806. ValueConv => '-$val/6',
  4807. ValueConvInv => '-6 * $val',
  4808. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  4809. PrintConvInv => '$val',
  4810. },
  4811. ],
  4812. );
  4813. # Flash information for D40, D40x, D3 and D300 (ref JD)
  4814. %Image::ExifTool::Nikon::FlashInfo0102 = (
  4815. %binaryDataAttrs,
  4816. DATAMEMBER => [ 9.2, 16.1, 17.1, 17.2 ],
  4817. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4818. NOTES => q{
  4819. These tags are used by the D3 (firmware 1.x), D40, D40X, D60 and D300
  4820. (firmware 1.00).
  4821. },
  4822. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  4823. 0 => {
  4824. Name => 'FlashInfoVersion',
  4825. Format => 'string[4]',
  4826. Writable => 0,
  4827. },
  4828. 4 => { #PH
  4829. Name => 'FlashSource',
  4830. PrintConv => {
  4831. 0 => 'None',
  4832. 1 => 'External',
  4833. 2 => 'Internal',
  4834. },
  4835. },
  4836. # 5 - values: 46,48,50,54,78
  4837. 6 => {
  4838. Format => 'int8u[2]',
  4839. Name => 'ExternalFlashFirmware',
  4840. SeparateTable => 'FlashFirmware',
  4841. PrintConv => \%flashFirmware,
  4842. },
  4843. 8 => {
  4844. Name => 'ExternalFlashFlags',
  4845. PrintConv => { BITMASK => {
  4846. 0 => 'Fired', #28
  4847. 2 => 'Bounce Flash', #PH
  4848. 4 => 'Wide Flash Adapter',
  4849. 5 => 'Dome Diffuser', #28
  4850. }},
  4851. },
  4852. 9.1 => {
  4853. Name => 'FlashCommanderMode',
  4854. Mask => 0x80,
  4855. PrintConv => {
  4856. 0x00 => 'Off',
  4857. 0x80 => 'On',
  4858. },
  4859. },
  4860. 9.2 => {
  4861. Name => 'FlashControlMode',
  4862. Mask => 0x7f,
  4863. DataMember => 'FlashControlMode',
  4864. RawConv => '$$self{FlashControlMode} = $val',
  4865. PrintConv => \%flashControlMode,
  4866. SeparateTable => 'FlashControlMode',
  4867. },
  4868. 10 => [
  4869. {
  4870. Name => 'FlashOutput',
  4871. Condition => '$$self{FlashControlMode} >= 0x06',
  4872. ValueConv => '2 ** (-$val/6)',
  4873. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  4874. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  4875. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  4876. },
  4877. {
  4878. Name => 'FlashCompensation',
  4879. # this is the compensation from the camera (0x0012) for "Built-in" FlashType, or
  4880. # the compensation from the external unit (0x0017) for "Optional" FlashType - PH
  4881. Format => 'int8s',
  4882. Priority => 0,
  4883. ValueConv => '-$val/6',
  4884. ValueConvInv => '-6 * $val',
  4885. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  4886. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  4887. },
  4888. ],
  4889. 12 => {
  4890. Name => 'FlashFocalLength',
  4891. RawConv => '$val ? $val : undef',
  4892. PrintConv => '"$val mm"',
  4893. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  4894. },
  4895. 13 => {
  4896. Name => 'RepeatingFlashRate',
  4897. RawConv => '$val ? $val : undef',
  4898. PrintConv => '"$val Hz"',
  4899. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  4900. },
  4901. 14 => {
  4902. Name => 'RepeatingFlashCount',
  4903. RawConv => '$val ? $val : undef',
  4904. },
  4905. 15 => { #PH
  4906. Name => 'FlashGNDistance',
  4907. SeparateTable => 1,
  4908. PrintConv => \%flashGNDistance,
  4909. },
  4910. 16.1 => {
  4911. Name => 'FlashGroupAControlMode',
  4912. Mask => 0x0f,
  4913. Notes => 'note: group A tags may apply to the built-in flash settings for some models',
  4914. DataMember => 'FlashGroupAControlMode',
  4915. RawConv => '$$self{FlashGroupAControlMode} = $val',
  4916. PrintConv => \%flashControlMode,
  4917. SeparateTable => 'FlashControlMode',
  4918. },
  4919. 17.1 => {
  4920. Name => 'FlashGroupBControlMode',
  4921. Mask => 0xf0,
  4922. Notes => 'note: group B tags may apply to group A settings for some models',
  4923. DataMember => 'FlashGroupBControlMode',
  4924. RawConv => '$$self{FlashGroupBControlMode} = $val',
  4925. ValueConv => '$val >> 4',
  4926. ValueConvInv => '$val << 4',
  4927. PrintConv => \%flashControlMode,
  4928. SeparateTable => 'FlashControlMode',
  4929. },
  4930. 17.2 => { #PH
  4931. Name => 'FlashGroupCControlMode',
  4932. Mask => 0x0f,
  4933. Notes => 'note: group C tags may apply to group B settings for some models',
  4934. DataMember => 'FlashGroupCControlMode',
  4935. RawConv => '$$self{FlashGroupCControlMode} = $val',
  4936. PrintConv => \%flashControlMode,
  4937. SeparateTable => 'FlashControlMode',
  4938. },
  4939. 18 => [
  4940. {
  4941. Name => 'FlashGroupAOutput',
  4942. Condition => '$$self{FlashGroupAControlMode} >= 0x06',
  4943. ValueConv => '2 ** (-$val/6)',
  4944. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  4945. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  4946. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  4947. },
  4948. {
  4949. Name => 'FlashGroupACompensation',
  4950. Format => 'int8s',
  4951. ValueConv => '-$val/6',
  4952. ValueConvInv => '-6 * $val',
  4953. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  4954. PrintConvInv => '$val',
  4955. },
  4956. ],
  4957. 19 => [
  4958. {
  4959. Name => 'FlashGroupBOutput',
  4960. Condition => '$$self{FlashGroupBControlMode} >= 0x60',
  4961. ValueConv => '2 ** (-$val/6)',
  4962. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  4963. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  4964. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  4965. },
  4966. {
  4967. Name => 'FlashGroupBCompensation',
  4968. Format => 'int8s',
  4969. ValueConv => '-$val/6',
  4970. ValueConvInv => '-6 * $val',
  4971. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  4972. PrintConvInv => '$val',
  4973. },
  4974. ],
  4975. 20 => [ #PH
  4976. {
  4977. Name => 'FlashGroupCOutput',
  4978. Condition => '$$self{FlashGroupCControlMode} >= 0x06',
  4979. ValueConv => '2 ** (-$val/6)',
  4980. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  4981. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  4982. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  4983. },
  4984. {
  4985. Name => 'FlashGroupCCompensation',
  4986. Format => 'int8s',
  4987. ValueConv => '-$val/6',
  4988. ValueConvInv => '-6 * $val',
  4989. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  4990. PrintConvInv => '$val',
  4991. },
  4992. ],
  4993. );
  4994. # Flash information for D90 and D700 (ref PH)
  4995. # - confirmed in detail for D800 (0105) - PH
  4996. %Image::ExifTool::Nikon::FlashInfo0103 = (
  4997. %binaryDataAttrs,
  4998. DATAMEMBER => [ 9.2, 17.1, 18.1, 18.2 ],
  4999. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5000. NOTES => q{
  5001. These tags are used by the D3 (firmware 2.x), D3X, D3S, D4, D90, D300
  5002. (firmware 1.10), D300S, D600, D700, D800, D3000, D3100, D3200, D5000, D5100,
  5003. D5200, D7000.
  5004. },
  5005. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  5006. 0 => {
  5007. Name => 'FlashInfoVersion',
  5008. Format => 'string[4]',
  5009. Writable => 0,
  5010. },
  5011. 4 => { #PH
  5012. Name => 'FlashSource',
  5013. PrintConv => {
  5014. 0 => 'None',
  5015. 1 => 'External',
  5016. 2 => 'Internal',
  5017. },
  5018. },
  5019. # 5 - values: 46,48,50,54,78
  5020. 6 => {
  5021. Format => 'int8u[2]',
  5022. Name => 'ExternalFlashFirmware',
  5023. SeparateTable => 'FlashFirmware',
  5024. PrintConv => \%flashFirmware,
  5025. },
  5026. 8 => {
  5027. Name => 'ExternalFlashFlags',
  5028. PrintConv => { BITMASK => {
  5029. 0 => 'Fired', #28
  5030. 2 => 'Bounce Flash', #PH
  5031. 4 => 'Wide Flash Adapter',
  5032. 5 => 'Dome Diffuser', #28
  5033. }},
  5034. },
  5035. 9.1 => {
  5036. Name => 'FlashCommanderMode',
  5037. Mask => 0x80,
  5038. PrintConv => {
  5039. 0x00 => 'Off',
  5040. 0x80 => 'On',
  5041. },
  5042. },
  5043. 9.2 => {
  5044. Name => 'FlashControlMode',
  5045. Mask => 0x7f,
  5046. DataMember => 'FlashControlMode',
  5047. RawConv => '$$self{FlashControlMode} = $val',
  5048. PrintConv => \%flashControlMode,
  5049. SeparateTable => 'FlashControlMode',
  5050. },
  5051. 10 => [
  5052. {
  5053. Name => 'FlashOutput',
  5054. Condition => '$$self{FlashControlMode} >= 0x06',
  5055. ValueConv => '2 ** (-$val/6)',
  5056. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  5057. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  5058. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  5059. },
  5060. {
  5061. Name => 'FlashCompensation',
  5062. # this is the compensation from the camera (0x0012) for "Built-in" FlashType, or
  5063. # the compensation from the external unit (0x0017) for "Optional" FlashType - PH
  5064. Format => 'int8s',
  5065. Priority => 0,
  5066. ValueConv => '-$val/6',
  5067. ValueConvInv => '-6 * $val',
  5068. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  5069. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  5070. },
  5071. ],
  5072. 12 => { #JD
  5073. Name => 'FlashFocalLength',
  5074. RawConv => '($val and $val != 255) ? $val : undef',
  5075. PrintConv => '"$val mm"',
  5076. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  5077. },
  5078. 13 => { #JD
  5079. Name => 'RepeatingFlashRate',
  5080. RawConv => '($val and $val != 255) ? $val : undef',
  5081. PrintConv => '"$val Hz"',
  5082. PrintConvInv => '$val=~/(\d+)/; $1 || 0',
  5083. },
  5084. 14 => { #JD
  5085. Name => 'RepeatingFlashCount',
  5086. RawConv => '($val and $val != 255) ? $val : undef',
  5087. },
  5088. 15 => { #28
  5089. Name => 'FlashGNDistance',
  5090. SeparateTable => 1,
  5091. PrintConv => \%flashGNDistance,
  5092. },
  5093. 16 => { #28
  5094. Name => 'FlashColorFilter',
  5095. PrintConv => {
  5096. 0x00 => 'None',
  5097. 1 => 'FL-GL1',
  5098. 2 => 'FL-GL2',
  5099. 9 => 'TN-A1',
  5100. 10 => 'TN-A2',
  5101. 65 => 'Red',
  5102. 66 => 'Blue',
  5103. 67 => 'Yellow',
  5104. 68 => 'Amber',
  5105. },
  5106. },
  5107. 17.1 => {
  5108. Name => 'FlashGroupAControlMode',
  5109. Mask => 0x0f,
  5110. Notes => 'note: group A tags may apply to the built-in flash settings for some models',
  5111. DataMember => 'FlashGroupAControlMode',
  5112. RawConv => '$$self{FlashGroupAControlMode} = $val',
  5113. PrintConv => \%flashControlMode,
  5114. SeparateTable => 'FlashControlMode',
  5115. },
  5116. 18.1 => {
  5117. Name => 'FlashGroupBControlMode',
  5118. Mask => 0xf0,
  5119. Notes => 'note: group B tags may apply to group A settings for some models',
  5120. DataMember => 'FlashGroupBControlMode',
  5121. RawConv => '$$self{FlashGroupBControlMode} = $val',
  5122. ValueConv => '$val >> 4',
  5123. ValueConvInv => '$val << 4',
  5124. PrintConv => \%flashControlMode,
  5125. SeparateTable => 'FlashControlMode',
  5126. },
  5127. 18.2 => { #PH
  5128. Name => 'FlashGroupCControlMode',
  5129. Mask => 0x0f,
  5130. Notes => 'note: group C tags may apply to group B settings for some models',
  5131. DataMember => 'FlashGroupCControlMode',
  5132. RawConv => '$$self{FlashGroupCControlMode} = $val',
  5133. PrintConv => \%flashControlMode,
  5134. SeparateTable => 'FlashControlMode',
  5135. },
  5136. 19 => [
  5137. {
  5138. Name => 'FlashGroupAOutput',
  5139. Condition => '$$self{FlashGroupAControlMode} >= 0x06',
  5140. ValueConv => '2 ** (-$val/6)',
  5141. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  5142. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  5143. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  5144. },
  5145. {
  5146. Name => 'FlashGroupACompensation',
  5147. Format => 'int8s',
  5148. ValueConv => '-$val/6',
  5149. ValueConvInv => '-6 * $val',
  5150. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  5151. PrintConvInv => '$val',
  5152. },
  5153. ],
  5154. 20 => [
  5155. {
  5156. Name => 'FlashGroupBOutput',
  5157. Condition => '$$self{FlashGroupBControlMode} >= 0x60',
  5158. ValueConv => '2 ** (-$val/6)',
  5159. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  5160. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  5161. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  5162. },
  5163. {
  5164. Name => 'FlashGroupBCompensation',
  5165. Format => 'int8s',
  5166. ValueConv => '-$val/6',
  5167. ValueConvInv => '-6 * $val',
  5168. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  5169. PrintConvInv => '$val',
  5170. },
  5171. ],
  5172. 21 => [ #PH
  5173. {
  5174. Name => 'FlashGroupCOutput',
  5175. Condition => '$$self{FlashGroupCControlMode} >= 0x06',
  5176. ValueConv => '2 ** (-$val/6)',
  5177. ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
  5178. PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
  5179. PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
  5180. },
  5181. {
  5182. Name => 'FlashGroupCCompensation',
  5183. Format => 'int8s',
  5184. ValueConv => '-$val/6',
  5185. ValueConvInv => '-6 * $val',
  5186. PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
  5187. PrintConvInv => '$val',
  5188. },
  5189. ],
  5190. 0x1b => { #PH
  5191. Name => 'ExternalFlashCompensation',
  5192. Format => 'int8s',
  5193. Priority => 0,
  5194. ValueConv => '-$val/6',
  5195. ValueConvInv => '-6 * $val',
  5196. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  5197. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  5198. },
  5199. 0x1d => { #PH
  5200. Name => 'FlashExposureComp3',
  5201. Format => 'int8s',
  5202. # (does not include the built-in compensation for FlashType "Built-in,TTL&Comdr.")
  5203. Notes => 'does not include the effect of flash bracketing',
  5204. Priority => 0,
  5205. ValueConv => '-$val/6',
  5206. ValueConvInv => '-6 * $val',
  5207. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  5208. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  5209. },
  5210. 0x27 => { #PH (same as ShotInfoD800 0x4d2 but also valid for repeating flash)
  5211. Name => 'FlashExposureComp4',
  5212. Format => 'int8s',
  5213. Notes => 'includes the effect of flash bracketing. Valid for repeating flash',
  5214. Priority => 0,
  5215. ValueConv => '-$val/6',
  5216. ValueConvInv => '-6 * $val',
  5217. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  5218. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  5219. },
  5220. # 0x2b - related to flash power (PH, D800, 96=full,62=1/4,2=1/128)
  5221. );
  5222. # Unknown Flash information
  5223. %Image::ExifTool::Nikon::FlashInfoUnknown = (
  5224. %binaryDataAttrs,
  5225. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5226. 0 => {
  5227. Name => 'FlashInfoVersion',
  5228. Format => 'string[4]',
  5229. Writable => 0,
  5230. },
  5231. );
  5232. # Multi exposure / image overlay information (ref PH)
  5233. %Image::ExifTool::Nikon::MultiExposure = (
  5234. %binaryDataAttrs,
  5235. FORMAT => 'int32u',
  5236. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5237. # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
  5238. 0 => {
  5239. Name => 'MultiExposureVersion',
  5240. Format => 'string[4]',
  5241. Writable => 0,
  5242. },
  5243. 1 => {
  5244. Name => 'MultiExposureMode',
  5245. PrintConv => {
  5246. 0 => 'Off',
  5247. 1 => 'Multiple Exposure',
  5248. 2 => 'Image Overlay',
  5249. 3 => 'HDR', #31
  5250. },
  5251. },
  5252. 2 => 'MultiExposureShots',
  5253. 3 => {
  5254. Name => 'MultiExposureAutoGain',
  5255. PrintConv => \%offOn,
  5256. },
  5257. );
  5258. # HDR information (ref 32)
  5259. %Image::ExifTool::Nikon::HDRInfo = (
  5260. %binaryDataAttrs,
  5261. GROUPS => { 0 => 'MakerNotes', 2 => 'Location' },
  5262. 0 => {
  5263. Name => 'HDRInfoVersion',
  5264. Format => 'string[4]',
  5265. },
  5266. 4 => {
  5267. Name => 'HDR',
  5268. PrintConv => {
  5269. 0 => 'Off',
  5270. 1 => 'On',
  5271. 48 => 'Auto', #PH (NC)
  5272. },
  5273. },
  5274. 5 => {
  5275. Name => 'HDRLevel',
  5276. PrintConv => {
  5277. 0 => 'Auto',
  5278. 1 => '1 EV',
  5279. 2 => '2 EV',
  5280. 3 => '3 EV',
  5281. # 5 - seen for 1J4
  5282. 255 => 'n/a', #PH
  5283. },
  5284. },
  5285. 6 => {
  5286. Name => 'HDRSmoothing',
  5287. PrintConv => {
  5288. 0 => 'Off',
  5289. 1 => 'Normal',
  5290. 2 => 'Low',
  5291. 3 => 'High',
  5292. 48 => 'Auto', #PH (NC)
  5293. 255 => 'n/a', #PH
  5294. },
  5295. },
  5296. 7 => { #PH (P330, HDRInfoVersion=0101)
  5297. Name => 'HDRLevel2',
  5298. PrintConv => {
  5299. 0 => 'Auto',
  5300. 1 => '1 EV',
  5301. 2 => '2 EV',
  5302. 3 => '3 EV',
  5303. 255 => 'n/a',
  5304. },
  5305. },
  5306. );
  5307. # location information (ref PH)
  5308. %Image::ExifTool::Nikon::LocationInfo = (
  5309. %binaryDataAttrs,
  5310. DATAMEMBER => [ 4 ],
  5311. GROUPS => { 0 => 'MakerNotes', 2 => 'Location' },
  5312. NOTES => 'Tags written by some Nikon GPS-equipped cameras like the AW100.',
  5313. 0 => {
  5314. Name => 'LocationInfoVersion',
  5315. Format => 'undef[4]',
  5316. },
  5317. 4 => {
  5318. Name => 'TextEncoding',
  5319. DataMember => 'TextEncoding',
  5320. RawConv => q{
  5321. $$self{TextEncoding} = $Image::ExifTool::Nikon::nikonTextEncoding{$val} if $val;
  5322. return $val;
  5323. },
  5324. PrintConv => \%Image::ExifTool::Nikon::nikonTextEncoding,
  5325. },
  5326. # (the CountryCode and Location tag names chosen to correspond with XMP::iptcCore)
  5327. 5 => {
  5328. Name => 'CountryCode',
  5329. Format => 'undef[3]',
  5330. ValueConv => '$val=~s/\0.*//s; $val', # truncate at null
  5331. ValueConvInv => '$val',
  5332. },
  5333. 8 => 'POILevel', #forum5782
  5334. 9 => {
  5335. Name => 'Location',
  5336. Format => 'undef[70]',
  5337. RawConv => '$$self{TextEncoding} ? $self->Decode($val,$$self{TextEncoding},"MM") : $val',
  5338. RawConvInv => '$$self{TextEncoding} ? $self->Encode($val,$$self{TextEncoding},"MM") : $val',
  5339. },
  5340. );
  5341. # tags in Nikon QuickTime videos (PH - observations with Coolpix S3)
  5342. # (similar information in Kodak,Minolta,Nikon,Olympus,Pentax and Sanyo videos)
  5343. %Image::ExifTool::Nikon::MOV = (
  5344. PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
  5345. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5346. FIRST_ENTRY => 0,
  5347. NOTES => q{
  5348. This information is found in MOV and QT videos from some Nikon cameras.
  5349. },
  5350. 0x00 => {
  5351. Name => 'Make',
  5352. Format => 'string[24]',
  5353. },
  5354. 0x18 => {
  5355. Name => 'Model',
  5356. Description => 'Camera Model Name',
  5357. Format => 'string[8]',
  5358. },
  5359. # (01 00 at offset 0x20)
  5360. 0x26 => {
  5361. Name => 'ExposureTime',
  5362. Format => 'int32u',
  5363. ValueConv => '$val ? 10 / $val : 0',
  5364. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  5365. },
  5366. 0x2a => {
  5367. Name => 'FNumber',
  5368. Format => 'rational64u',
  5369. PrintConv => 'sprintf("%.1f",$val)',
  5370. },
  5371. 0x32 => {
  5372. Name => 'ExposureCompensation',
  5373. Format => 'rational64s',
  5374. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  5375. },
  5376. 0x44 => {
  5377. Name => 'WhiteBalance',
  5378. Format => 'int16u',
  5379. PrintConv => {
  5380. 0 => 'Auto',
  5381. 1 => 'Daylight',
  5382. 2 => 'Shade',
  5383. 3 => 'Fluorescent', #2
  5384. 4 => 'Tungsten',
  5385. 5 => 'Manual',
  5386. },
  5387. },
  5388. 0x48 => {
  5389. Name => 'FocalLength',
  5390. Format => 'rational64u',
  5391. PrintConv => 'sprintf("%.1f mm",$val)',
  5392. },
  5393. 0xaf => {
  5394. Name => 'Software',
  5395. Format => 'string[16]',
  5396. },
  5397. 0xdf => { # (this is a guess ... could also be offset 0xdb)
  5398. Name => 'ISO',
  5399. Format => 'int16u',
  5400. RawConv => '$val < 50 ? undef : $val', # (not valid for Coolpix L10)
  5401. },
  5402. );
  5403. # Nikon metadata in AVI videos (PH)
  5404. %Image::ExifTool::Nikon::AVI = (
  5405. NOTES => 'Nikon-specific RIFF tags found in AVI videos.',
  5406. GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
  5407. nctg => {
  5408. Name => 'NikonTags',
  5409. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AVITags' },
  5410. },
  5411. ncth => {
  5412. Name => 'ThumbnailImage',
  5413. Groups => { 2 => 'Preview' },
  5414. Binary => 1,
  5415. },
  5416. ncvr => {
  5417. Name => 'NikonVers',
  5418. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AVIVers' },
  5419. },
  5420. ncvw => {
  5421. Name => 'PreviewImage',
  5422. Groups => { 2 => 'Preview' },
  5423. RawConv => 'length($val) ? $val : undef',
  5424. Binary => 1,
  5425. },
  5426. );
  5427. # version information in AVI videos (PH)
  5428. %Image::ExifTool::Nikon::AVIVers = (
  5429. GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
  5430. PROCESS_PROC => \&ProcessNikonAVI,
  5431. FORMAT => 'string',
  5432. 0x01 => 'MakerNoteType',
  5433. 0x02 => {
  5434. Name => 'MakerNoteVersion',
  5435. Format => 'int8u',
  5436. ValueConv => 'my @a = reverse split " ", $val; join ".", @a;',
  5437. },
  5438. );
  5439. # tags in AVI videos (PH)
  5440. %Image::ExifTool::Nikon::AVITags = (
  5441. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5442. PROCESS_PROC => \&ProcessNikonAVI,
  5443. FORMAT => 'string',
  5444. NOTES => q{
  5445. These tags and the AVIVer tags below are found in proprietary-format records
  5446. of Nikon AVI videos.
  5447. },
  5448. 0x03 => 'Make',
  5449. 0x04 => 'Model',
  5450. 0x05 => {
  5451. Name => 'Software',
  5452. Format => 'undef',
  5453. ValueConv => '$val =~ tr/\0//d; $val',
  5454. },
  5455. 0x06 => 'Equipment', # "NIKON DIGITAL CAMERA"
  5456. 0x07 => { # (guess)
  5457. Name => 'Orientation',
  5458. Format => 'int16u',
  5459. Groups => { 2 => 'Image' },
  5460. PrintConv => \%Image::ExifTool::Exif::orientation,
  5461. },
  5462. 0x08 => {
  5463. Name => 'ExposureTime',
  5464. Format => 'rational64u',
  5465. Groups => { 2 => 'Image' },
  5466. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  5467. },
  5468. 0x09 => {
  5469. Name => 'FNumber',
  5470. Format => 'rational64u',
  5471. Groups => { 2 => 'Image' },
  5472. PrintConv => 'sprintf("%.1f",$val)',
  5473. },
  5474. 0x0a => {
  5475. Name => 'ExposureCompensation',
  5476. Format => 'rational64s',
  5477. Groups => { 2 => 'Image' },
  5478. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  5479. },
  5480. 0x0b => {
  5481. Name => 'MaxApertureValue',
  5482. Format => 'rational64u',
  5483. ValueConv => '2 ** ($val / 2)',
  5484. PrintConv => 'sprintf("%.1f",$val)',
  5485. },
  5486. 0x0c => {
  5487. Name => 'MeteringMode', # (guess)
  5488. Format => 'int16u',
  5489. PrintConv => {
  5490. 0 => 'Unknown',
  5491. 1 => 'Average',
  5492. 2 => 'Center-weighted average',
  5493. 3 => 'Spot',
  5494. 4 => 'Multi-spot',
  5495. 5 => 'Multi-segment',
  5496. 6 => 'Partial',
  5497. 255 => 'Other',
  5498. },
  5499. },
  5500. 0x0d => { # val: 0
  5501. Name => 'Nikon_AVITags_0x000d',
  5502. Format => 'int16u',
  5503. Flags => [ 'Hidden', 'Unknown' ],
  5504. },
  5505. 0x0e => { # val: 0
  5506. Name => 'Nikon_AVITags_0x000e',
  5507. Format => 'int16u',
  5508. Flags => [ 'Hidden', 'Unknown' ],
  5509. },
  5510. 0x0f => {
  5511. Name => 'FocalLength',
  5512. Format => 'rational64u',
  5513. PrintConv => 'sprintf("%.1f mm",$val)',
  5514. },
  5515. 0x10 => {
  5516. Name => 'XResolution',
  5517. Format => 'rational64u',
  5518. Groups => { 2 => 'Image' },
  5519. },
  5520. 0x11 => {
  5521. Name => 'YResolution',
  5522. Format => 'rational64u',
  5523. Groups => { 2 => 'Image' },
  5524. },
  5525. 0x12 => {
  5526. Name => 'ResolutionUnit',
  5527. Format => 'int16u',
  5528. Groups => { 2 => 'Image' },
  5529. PrintConv => {
  5530. 1 => 'None',
  5531. 2 => 'inches',
  5532. 3 => 'cm',
  5533. },
  5534. },
  5535. 0x13 => {
  5536. Name => 'DateTimeOriginal', # (guess)
  5537. Description => 'Date/Time Original',
  5538. Groups => { 2 => 'Time' },
  5539. PrintConv => '$self->ConvertDateTime($val)',
  5540. },
  5541. 0x14 => {
  5542. Name => 'CreateDate', # (guess)
  5543. Groups => { 2 => 'Time' },
  5544. PrintConv => '$self->ConvertDateTime($val)',
  5545. },
  5546. 0x15 => {
  5547. Name => 'Nikon_AVITags_0x0015',
  5548. Format => 'int16u',
  5549. Flags => [ 'Hidden', 'Unknown' ],
  5550. },
  5551. 0x16 => {
  5552. Name => 'Duration',
  5553. Format => 'rational64u',
  5554. PrintConv => '"$val s"',
  5555. },
  5556. 0x17 => { # val: 1
  5557. Name => 'Nikon_AVITags_0x0017',
  5558. Format => 'int16u',
  5559. Flags => [ 'Hidden', 'Unknown' ],
  5560. },
  5561. 0x18 => 'FocusMode',
  5562. 0x19 => { # vals: -5, -2, 3, 5, 6, 8, 11, 12, 14, 20, 22
  5563. Name => 'Nikon_AVITags_0x0019',
  5564. Format => 'int32s',
  5565. Flags => [ 'Hidden', 'Unknown' ],
  5566. },
  5567. 0x1b => { # vals: 1 (640x480), 1.25 (320x240)
  5568. Name => 'DigitalZoom',
  5569. Format => 'rational64u',
  5570. },
  5571. 0x1c => { # (same as Nikon_0x000a)
  5572. Name => 'Nikon_AVITags_0x001c',
  5573. Format => 'rational64u',
  5574. Flags => [ 'Hidden', 'Unknown' ],
  5575. },
  5576. 0x1d => 'ColorMode',
  5577. 0x1e => { # string[8] - val: "AUTO"
  5578. Name => 'Sharpness', # (guess, could also be ISOSelection)
  5579. },
  5580. 0x1f => { # string[16] - val: "AUTO"
  5581. Name => 'WhiteBalance', # (guess, could also be ImageAdjustment)
  5582. },
  5583. 0x20 => { # string[4] - val: "OFF"
  5584. Name => 'NoiseReduction', # (guess)
  5585. },
  5586. 0x801a => { # val: 0 (why is the 0x8000 bit set in the ID?)
  5587. Name => 'Nikon_AVITags_0x801a',
  5588. Format => 'int32s',
  5589. Flags => [ 'Hidden', 'Unknown' ],
  5590. }
  5591. );
  5592. # Nikon NCDT atoms (ref PH)
  5593. %Image::ExifTool::Nikon::NCDT = (
  5594. GROUPS => { 0 => 'MakerNotes', 1 => 'Nikon', 2 => 'Video' },
  5595. NOTES => q{
  5596. Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from
  5597. various Nikon models.
  5598. },
  5599. NCHD => {
  5600. Name => 'MakerNoteVersion',
  5601. Format => 'undef',
  5602. ValueConv => q{
  5603. $val =~ s/\0$//; # remove trailing null
  5604. $val =~ s/([\0-\x1f])/'.'.ord($1)/ge;
  5605. $val =~ s/\./ /; return $val;
  5606. },
  5607. },
  5608. NCTG => {
  5609. Name => 'NikonTags',
  5610. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::NCTG' },
  5611. },
  5612. NCTH => {
  5613. Name => 'ThumbnailImage',
  5614. Groups => { 2 => 'Preview' },
  5615. Format => 'undef',
  5616. Binary => 1,
  5617. },
  5618. NCVW => {
  5619. Name => 'PreviewImage',
  5620. Groups => { 2 => 'Preview' },
  5621. Format => 'undef',
  5622. Binary => 1,
  5623. },
  5624. NCDB => { # (often 0 bytes long, or 4 null bytes)
  5625. Name => 'NikonNCDB',
  5626. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::NCDB' },
  5627. }
  5628. );
  5629. # Nikon NCDB tags from MOV videos (ref PH)
  5630. %Image::ExifTool::Nikon::NCDB = (
  5631. GROUPS => { 0 => 'MakerNotes', 1 => 'Nikon', 2 => 'Video' },
  5632. # OP01 - 320 bytes, starts with "0200" (D600,D610,D810,D3200,D5200)
  5633. # - 638 bytes, starts with "0200" (D7100)
  5634. # OP02 - 2048 bytes, starts with "0200" (D810)
  5635. );
  5636. # Nikon NCTG tags from MOV videos (ref PH)
  5637. %Image::ExifTool::Nikon::NCTG = (
  5638. PROCESS_PROC => \&ProcessNikonMOV,
  5639. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5640. NOTES => q{
  5641. These tags are found in proprietary-format records of the NCTG atom in MOV
  5642. videos from some Nikon cameras.
  5643. },
  5644. 0x01 => 'Make',
  5645. 0x02 => 'Model',
  5646. 0x03 => 'Software',
  5647. 0x11 => {
  5648. Name => 'CreateDate', #(guess, but matches QuickTime CreateDate)
  5649. Groups => { 2 => 'Time' },
  5650. PrintConv => '$self->ConvertDateTime($val)',
  5651. },
  5652. 0x12 => {
  5653. Name => 'DateTimeOriginal', #(guess, but time is 1 sec before tag 0x11)
  5654. Description => 'Date/Time Original',
  5655. Groups => { 2 => 'Time' },
  5656. PrintConv => '$self->ConvertDateTime($val)',
  5657. },
  5658. 0x13 => {
  5659. Name => 'FrameCount',
  5660. # int32u[2]: "467 0", "1038 0", "1127 0"
  5661. ValueConv => '$val =~ s/ 0$//; $val', # (not sure what the extra "0" is for)
  5662. },
  5663. # 0x14 - int32u[2]: "0 0"
  5664. # 0x15 - int32u[2]: "0 0"
  5665. 0x16 => {
  5666. Name => 'FrameRate',
  5667. Groups => { 2 => 'Video' },
  5668. PrintConv => 'int($val * 1000 + 0.5) / 1000',
  5669. },
  5670. # 0x17 - rational62u: same value as FrameRate
  5671. # 0x18 - int16u: 1, 2
  5672. # 0x21 - int16u: 1, 2
  5673. 0x22 => {
  5674. Name => 'FrameWidth',
  5675. Groups => { 2 => 'Video' },
  5676. },
  5677. 0x23 => {
  5678. Name => 'FrameHeight',
  5679. Groups => { 2 => 'Video' },
  5680. },
  5681. # 0x24 - int16u: 1, 2
  5682. # 0x31 - int16u: 0, 1, 2
  5683. 0x32 => { #(guess)
  5684. Name => 'AudioChannels',
  5685. Groups => { 2 => 'Audio' },
  5686. },
  5687. 0x33 => {
  5688. Name => 'AudioBitsPerSample',
  5689. Groups => { 2 => 'Audio' },
  5690. },
  5691. 0x34 => {
  5692. Name => 'AudioSampleRate',
  5693. Groups => { 2 => 'Audio' },
  5694. },
  5695. # 0x1001 - int16s: 0
  5696. # 0x1011 - int32u: 0
  5697. # 0x1012 - int32u: 0
  5698. # 0x1021 - int32u[32]: all zeros
  5699. #
  5700. # 0x110**** tags correspond to 0x**** tags in Exif::Main
  5701. #
  5702. 0x110829a => { #34
  5703. Name => 'ExposureTime',
  5704. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  5705. },
  5706. 0x110829d => { #34
  5707. Name => 'FNumber',
  5708. PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
  5709. },
  5710. 0x1108822 => {
  5711. Name => 'ExposureProgram',
  5712. PrintConv => {
  5713. 0 => 'Not Defined',
  5714. 1 => 'Manual',
  5715. 2 => 'Program AE',
  5716. 3 => 'Aperture-priority AE',
  5717. 4 => 'Shutter speed priority AE',
  5718. 5 => 'Creative (Slow speed)',
  5719. 6 => 'Action (High speed)',
  5720. 7 => 'Portrait',
  5721. 8 => 'Landscape',
  5722. # 9 => 'Bulb', # (non-standard Canon value)
  5723. },
  5724. },
  5725. 0x1109204 => {
  5726. Name => 'ExposureCompensation',
  5727. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  5728. },
  5729. 0x1109207 => {
  5730. Name => 'MeteringMode',
  5731. PrintConv => {
  5732. 0 => 'Unknown',
  5733. 1 => 'Average',
  5734. 2 => 'Center-weighted average',
  5735. 3 => 'Spot',
  5736. 4 => 'Multi-spot',
  5737. 5 => 'Multi-segment',
  5738. 6 => 'Partial',
  5739. 255 => 'Other',
  5740. },
  5741. },
  5742. 0x110920a => { #34
  5743. Name => 'FocalLength',
  5744. PrintConv => 'sprintf("%.1f mm",$val)',
  5745. },
  5746. 0x110a434 => 'LensModel',
  5747. #
  5748. # 0x120**** tags correspond to 0x**** tags in GPS::Main
  5749. #
  5750. 0x1200000 => {
  5751. Name => 'GPSVersionID',
  5752. Groups => { 1 => 'GPS', 2 => 'Location' },
  5753. PrintConv => '$val =~ tr/ /./; $val',
  5754. },
  5755. 0x1200001 => {
  5756. Name => 'GPSLatitudeRef',
  5757. Groups => { 1 => 'GPS', 2 => 'Location' },
  5758. PrintConv => {
  5759. N => 'North',
  5760. S => 'South',
  5761. },
  5762. },
  5763. 0x1200002 => {
  5764. Name => 'GPSLatitude',
  5765. Groups => { 1 => 'GPS', 2 => 'Location' },
  5766. ValueConv => q{
  5767. require Image::ExifTool::GPS;
  5768. Image::ExifTool::GPS::ToDegrees($val);
  5769. },
  5770. PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
  5771. },
  5772. 0x1200003 => {
  5773. Name => 'GPSLongitudeRef',
  5774. Groups => { 1 => 'GPS', 2 => 'Location' },
  5775. PrintConv => {
  5776. E => 'East',
  5777. W => 'West',
  5778. },
  5779. },
  5780. 0x1200004 => {
  5781. Name => 'GPSLongitude',
  5782. Groups => { 1 => 'GPS', 2 => 'Location' },
  5783. ValueConv => q{
  5784. require Image::ExifTool::GPS;
  5785. Image::ExifTool::GPS::ToDegrees($val);
  5786. },
  5787. PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
  5788. },
  5789. 0x1200005 => {
  5790. Name => 'GPSAltitudeRef',
  5791. Groups => { 1 => 'GPS', 2 => 'Location' },
  5792. PrintConv => {
  5793. 0 => 'Above Sea Level',
  5794. 1 => 'Below Sea Level',
  5795. },
  5796. },
  5797. 0x1200006 => {
  5798. Name => 'GPSAltitude',
  5799. Groups => { 1 => 'GPS', 2 => 'Location' },
  5800. PrintConv => '$val =~ /^(inf|undef)$/ ? $val : "$val m"',
  5801. },
  5802. 0x1200007 => {
  5803. Name => 'GPSTimeStamp',
  5804. Groups => { 1 => 'GPS', 2 => 'Time' },
  5805. ValueConv => q{
  5806. require Image::ExifTool::GPS;
  5807. Image::ExifTool::GPS::ConvertTimeStamp($val);
  5808. },
  5809. PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
  5810. },
  5811. 0x1200008 => {
  5812. Name => 'GPSSatellites',
  5813. Groups => { 1 => 'GPS', 2 => 'Location' },
  5814. },
  5815. 0x1200010 => {
  5816. Name => 'GPSImgDirectionRef',
  5817. Groups => { 1 => 'GPS', 2 => 'Location' },
  5818. PrintConv => {
  5819. M => 'Magnetic North',
  5820. T => 'True North',
  5821. },
  5822. },
  5823. 0x1200011 => {
  5824. Name => 'GPSImgDirection',
  5825. Groups => { 1 => 'GPS', 2 => 'Location' },
  5826. },
  5827. 0x1200012 => {
  5828. Name => 'GPSMapDatum',
  5829. Groups => { 1 => 'GPS', 2 => 'Location' },
  5830. },
  5831. 0x120001d => {
  5832. Name => 'GPSDateStamp',
  5833. Groups => { 1 => 'GPS', 2 => 'Time' },
  5834. ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
  5835. },
  5836. #
  5837. # 0x200**** tags correspond to 0x**** tags in Nikon::Main
  5838. #
  5839. 0x2000001 => {
  5840. Name => 'MakerNoteVersion',
  5841. PrintConv => '$_=$val;s/^(\d{2})/$1\./;s/^0//;$_',
  5842. },
  5843. 0x2000005 => 'WhiteBalance',
  5844. 0x2000007 => { Name => 'FocusMode', Writable => 'string' }, #34
  5845. 0x200000b => 'WhiteBalanceFineTune',
  5846. 0x200001b => {
  5847. Name => 'CropHiSpeed',
  5848. Writable => 'int16u',
  5849. Count => 7,
  5850. PrintConv => q{
  5851. my @a = split ' ', $val;
  5852. return "Unknown ($val)" unless @a == 7;
  5853. $a[0] = $a[0] ? "On" : "Off";
  5854. return "$a[0] ($a[1]x$a[2] cropped to $a[3]x$a[4] at pixel $a[5],$a[6])";
  5855. }
  5856. },
  5857. 0x200001e => {
  5858. Name => 'ColorSpace',
  5859. PrintConv => {
  5860. 1 => 'sRGB',
  5861. 2 => 'Adobe RGB',
  5862. },
  5863. },
  5864. 0x200001f => {
  5865. Name => 'VRInfo',
  5866. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::VRInfo' },
  5867. },
  5868. 0x2000023 => {
  5869. Name => 'PictureControlData',
  5870. Flags => [ 'Binary', 'Protected' ],
  5871. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
  5872. },
  5873. 0x2000024 => {
  5874. Name => 'WorldTime',
  5875. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::WorldTime' },
  5876. },
  5877. 0x2000025 => { #34
  5878. Name => 'ISOInfo',
  5879. SubDirectory => {
  5880. TagTable => 'Image::ExifTool::Nikon::ISOInfo',
  5881. ByteOrder => 'BigEndian',
  5882. },
  5883. },
  5884. 0x200002c => {
  5885. Name => 'UnknownInfo',
  5886. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::UnknownInfo' },
  5887. },
  5888. # 0x200002d - int16u[3]: "512 0 0"
  5889. 0x2000032 => {
  5890. Name => 'UnknownInfo2',
  5891. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::UnknownInfo' },
  5892. },
  5893. 0x2000039 => {
  5894. Name => 'LocationInfo',
  5895. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LocationInfo' },
  5896. },
  5897. 0x2000083 => {
  5898. Name => 'LensType',
  5899. # credit to Tom Christiansen (ref 7) for figuring this out...
  5900. PrintConv => q[$_ = $val ? Image::ExifTool::DecodeBits($val,
  5901. {
  5902. 0 => 'MF',
  5903. 1 => 'D',
  5904. 2 => 'G',
  5905. 3 => 'VR',
  5906. }) : 'AF';
  5907. # remove commas and change "D G" to just "G"
  5908. s/,//g; s/\bD G\b/G/; $_
  5909. ],
  5910. },
  5911. 0x2000084 => {
  5912. Name => "Lens",
  5913. # short focal, long focal, aperture at short focal, aperture at long focal
  5914. PrintConv => \&Image::ExifTool::Exif::PrintLensInfo,
  5915. },
  5916. 0x2000087 => {
  5917. Name => 'FlashMode',
  5918. Writable => 'int8u',
  5919. PrintConv => {
  5920. 0 => 'Did Not Fire',
  5921. 1 => 'Fired, Manual', #14
  5922. 3 => 'Not Ready', #28
  5923. 7 => 'Fired, External', #14
  5924. 8 => 'Fired, Commander Mode',
  5925. 9 => 'Fired, TTL Mode',
  5926. },
  5927. },
  5928. # 0x20000a8 - Flash Info (seen 0107 - not yet decoded, PH)
  5929. 0x20000ab => { Name => 'VariProgram', Writable => 'string' }, #2 (scene mode for DSLR's - PH)
  5930. 0x20000b1 => { #34
  5931. Name => 'HighISONoiseReduction',
  5932. Writable => 'int16u',
  5933. PrintConv => {
  5934. 0 => 'Off',
  5935. 1 => 'Minimal', # for high ISO (>800) when setting is "Off"
  5936. 2 => 'Low', # Low,Normal,High take effect for ISO > 400
  5937. 3 => 'Medium Low',
  5938. 4 => 'Normal',
  5939. 5 => 'Medium High',
  5940. 6 => 'High',
  5941. },
  5942. },
  5943. 0x20000b7 => {
  5944. Name => 'AFInfo2',
  5945. SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2' },
  5946. },
  5947. );
  5948. # Nikon composite tags
  5949. %Image::ExifTool::Nikon::Composite = (
  5950. GROUPS => { 2 => 'Camera' },
  5951. LensSpec => {
  5952. Description => 'Lens',
  5953. Require => {
  5954. 0 => 'Nikon:Lens',
  5955. 1 => 'Nikon:LensType',
  5956. },
  5957. ValueConv => '"$val[0] $val[1]"',
  5958. PrintConv => '"$prt[0] $prt[1]"',
  5959. },
  5960. LensID => {
  5961. SeparateTable => 'Nikon LensID', # print values in a separate table
  5962. Require => {
  5963. 0 => 'Nikon:LensIDNumber',
  5964. 1 => 'LensFStops',
  5965. 2 => 'MinFocalLength',
  5966. 3 => 'MaxFocalLength',
  5967. 4 => 'MaxApertureAtMinFocal',
  5968. 5 => 'MaxApertureAtMaxFocal',
  5969. 6 => 'MCUVersion',
  5970. 7 => 'Nikon:LensType',
  5971. },
  5972. # construct lens ID string as per ref 11
  5973. ValueConv => 'sprintf("%.2X"." %.2X"x7, @raw)',
  5974. PrintConv => \%nikonLensIDs,
  5975. },
  5976. AutoFocus => {
  5977. Require => {
  5978. 0 => 'Nikon:PhaseDetectAF',
  5979. 1 => 'Nikon:ContrastDetectAF',
  5980. },
  5981. ValueConv => '($val[0] or $val[1]) ? 1 : 0',
  5982. PrintConv => \%offOn,
  5983. },
  5984. );
  5985. # add our composite tags
  5986. Image::ExifTool::AddCompositeTags('Image::ExifTool::Nikon');
  5987. #------------------------------------------------------------------------------
  5988. # Process Nikon AVI tags (D5000 videos)
  5989. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  5990. # Returns: 1 on success
  5991. sub ProcessNikonAVI($$$)
  5992. {
  5993. my ($et, $dirInfo, $tagTablePtr) = @_;
  5994. my $dataPt = $$dirInfo{DataPt};
  5995. my $pos = $$dirInfo{DirStart} || 0;
  5996. my $dirEnd = $pos + $$dirInfo{DirLen};
  5997. $et->VerboseDir($dirInfo, undef, $$dirInfo{DirLen});
  5998. SetByteOrder('II');
  5999. while ($pos + 4 <= $dirEnd) {
  6000. my $tag = Get16u($dataPt, $pos);
  6001. my $size = Get16u($dataPt, $pos + 2);
  6002. $pos += 4;
  6003. last if $pos + $size > $dirEnd;
  6004. $et->HandleTag($tagTablePtr, $tag, undef,
  6005. DataPt => $dataPt,
  6006. Start => $pos,
  6007. Size => $size,
  6008. );
  6009. $pos += $size;
  6010. }
  6011. return 1;
  6012. }
  6013. #------------------------------------------------------------------------------
  6014. # Print conversion for Nikon AF points
  6015. # Inputs: 0) value to convert (as a string of hex bytes),
  6016. # 1) lookup for AF point bit number (starting at 1)
  6017. sub PrintAFPoints($$)
  6018. {
  6019. my ($val, $afPoints) = @_;
  6020. my ($i, $j, @points);
  6021. $val =~ tr/ //d; # remove spaces from hex string
  6022. my @dat = unpack 'C*', pack 'H*', $val; # convert to array of bytes
  6023. # loop through all bytes to find active AF points
  6024. for ($i=0; $i<=@dat; ++$i) {
  6025. next unless $dat[$i];
  6026. for ($j=0; $j<8; ++$j) {
  6027. next unless $dat[$i] & (1 << $j);
  6028. my $point = $$afPoints{$i*8 + $j + 1};
  6029. push @points, $point if defined $point;
  6030. }
  6031. }
  6032. return '(none)' unless @points;
  6033. # sort the points and return as comma-separated string
  6034. return join ',', sort {
  6035. return $a cmp $b if length($a) == length($b);
  6036. return substr($a,0,1).'0'.substr($a,1,1) cmp $b if length($a) == 2;
  6037. return $a cmp substr($b,0,1).'0'.substr($b,1,1);
  6038. } @points;
  6039. }
  6040. #------------------------------------------------------------------------------
  6041. # Inverse print conversion for AF points
  6042. # Inputs: 0) AF point string, 1) AF point lookup, 2) size of data
  6043. # Returns: AF point data as a string of hex bytes
  6044. sub PrintAFPointsInv($$$)
  6045. {
  6046. my ($val, $afPoints, $size) = @_;
  6047. my @points = ($val =~ /[A-Za-z]\d+/g);
  6048. my @dat = (0) x $size;
  6049. if (@points) {
  6050. my (%bitNum, $point);
  6051. $bitNum{$$afPoints{$_}} = $_ foreach keys %$afPoints; # build reverse lookup
  6052. foreach $point (@points) {
  6053. my $bitNum = $bitNum{uc $point} or next;
  6054. my $byte = int(($bitNum - 1) / 8);
  6055. $dat[$byte] |= (1 << (($bitNum - 1) % 8));
  6056. }
  6057. }
  6058. return join(" ", unpack("H2"x$size, pack('C*', @dat)));
  6059. }
  6060. #------------------------------------------------------------------------------
  6061. # Get AF point name for grid-type AF
  6062. # Inputs: 0) AF point number, 1) number of columns, 2) true for inverse conversion
  6063. # Returns: AF point name, or undef
  6064. sub GetAFPointGrid($$;$)
  6065. {
  6066. my ($val, $ncol, $inv) = @_;
  6067. if ($inv) {
  6068. return undef unless $val =~ /^([A-J])(\d+)$/i;
  6069. return (ord(uc($1))-65) * $ncol + $2 - 1;
  6070. } else {
  6071. my $row = int(($val + 0.5) / $ncol);
  6072. my $col = $val - $ncol * $row + 1;
  6073. return chr(65+$row) . $col;
  6074. }
  6075. }
  6076. #------------------------------------------------------------------------------
  6077. # Print conversion for grid-type AF points
  6078. # Inputs: 0) value to convert (as a string of hex bytes),
  6079. # 1) number of columns in grid
  6080. sub PrintAFPointsGrid($$)
  6081. {
  6082. my ($val, $ncol) = @_;
  6083. my ($i, $j, @points);
  6084. $val =~ tr/ //d; # remove spaces from hex string
  6085. my @dat = unpack 'C*', pack 'H*', $val; # convert to array of bytes
  6086. # loop through all bytes to find active AF points
  6087. for ($i=0; $i<@dat; ++$i) {
  6088. next unless $dat[$i];
  6089. for ($j=0; $j<8; ++$j) {
  6090. next unless $dat[$i] & (1 << $j);
  6091. my $point = GetAFPointGrid($i*8 + $j, $ncol);
  6092. push @points, $point if defined $point;
  6093. }
  6094. }
  6095. return '(none)' unless @points;
  6096. return join ',', @points; # return as comma-separated string
  6097. }
  6098. #------------------------------------------------------------------------------
  6099. # Inverse print conversion for AF points
  6100. # Inputs: 0) AF point string, 1) number of columns, 2) size of data
  6101. # Returns: AF point data as a string of hex bytes
  6102. sub PrintAFPointsGridInv($$$)
  6103. {
  6104. my ($val, $ncol, $size) = @_;
  6105. my @points = ($val =~ /[A-Za-z]\d+/g);
  6106. my @dat = (0) x $size;
  6107. foreach (@points) {
  6108. my $n = GetAFPointGrid($_, $ncol, 1);
  6109. next unless defined $n;
  6110. my $byte = int($n / 8);
  6111. next if $byte > $size;
  6112. $dat[$byte] |= (1 << ($n - $byte * 8));
  6113. }
  6114. return join(" ", unpack("H2"x$size, pack('C*', @dat)));
  6115. }
  6116. #------------------------------------------------------------------------------
  6117. # Print PictureControl value
  6118. # Inputs: 0) value (with 0x80 subtracted),
  6119. # 1) 'Normal' (0 value) string (default 'Normal')
  6120. # 2) format string for numbers (default '%+d')
  6121. # Returns: PrintConv value
  6122. sub PrintPC($;$$)
  6123. {
  6124. my ($val, $norm, $fmt) = @_;
  6125. return $norm || 'Normal' if $val == 0;
  6126. return 'n/a' if $val == 0x7f;
  6127. return 'Auto' if $val == -128;
  6128. # -127 = custom curve created in Camera Control Pro (show as "User" by D3) - ref 28
  6129. return 'User' if $val == -127; #28
  6130. return sprintf($fmt || '%+d', $val);
  6131. }
  6132. #------------------------------------------------------------------------------
  6133. # Inverse of PrintPC
  6134. # Inputs: 0) PrintConv value (after subracting 0x80 from raw value)
  6135. # Returns: unconverted value
  6136. # Notes: raw values: 0=Auto, 1=User, 0xff=n/a, ... 0x7f=-1, 0x80=0, 0x81=1, ...
  6137. sub PrintPCInv($)
  6138. {
  6139. my $val = shift;
  6140. return $val if $val =~ /^[-+]?\d+$/;
  6141. return 0x7f if $val =~ /n\/a/i;
  6142. return -128 if $val =~ /auto/i;
  6143. return -127 if $val =~ /user/i; #28
  6144. return 0;
  6145. }
  6146. #------------------------------------------------------------------------------
  6147. # Convert unknown LensID values
  6148. # Inputs: 0) value, 1) flag for inverse conversion, 2) PrintConv hash ref
  6149. sub LensIDConv($$$)
  6150. {
  6151. my ($val, $inv, $conv) = @_;
  6152. return undef if $inv;
  6153. # multiple lenses with the same LensID are distinguished by decimal values
  6154. if ($$conv{"$val.1"}) {
  6155. my ($i, @vals, @user);
  6156. for ($i=1; ; ++$i) {
  6157. my $lens = $$conv{"$val.$i"} or last;
  6158. if ($Image::ExifTool::userLens{$lens}) {
  6159. push @user, $lens;
  6160. } else {
  6161. push @vals, $lens;
  6162. }
  6163. }
  6164. return join(' or ', @user) if @user;
  6165. return join(' or ', @vals);
  6166. }
  6167. # Sigma has been changing the LensID on some new lenses
  6168. # and with some Sigma lenses the LensFStops changes! (argh!)
  6169. my $pat = $val;
  6170. $pat =~ s/^\w+ \w+/.. ../;
  6171. my @ids = sort grep /^$pat$/, keys %$conv;
  6172. if (@ids) {
  6173. # first try different LensFStops (2nd value)
  6174. ($pat = $val) =~ s/ \w+/ ../;
  6175. my @good = grep /^$pat$/, @ids;
  6176. return $$conv{$good[0]} if @good;
  6177. # then try different LensType (1st value)
  6178. ($pat = $val) =~ s/^\w+/../;
  6179. @good = grep /^$pat$/, @ids;
  6180. return "Unknown ($val) $$conv{$good[0]} ?" if @good;
  6181. }
  6182. return undef;
  6183. }
  6184. #------------------------------------------------------------------------------
  6185. # Clean up formatting of string values
  6186. # Inputs: 0) string value
  6187. # Returns: formatted string value
  6188. # - removes trailing spaces and changes case to something more sensible
  6189. sub FormatString($)
  6190. {
  6191. my $str = shift;
  6192. # limit string length (can be very long for some unknown tags)
  6193. if (length($str) > 60) {
  6194. $str = substr($str,0,55) . "[...]";
  6195. } else {
  6196. $str =~ s/\s+$//; # remove trailing white space
  6197. # Don't change case of non-words (no vowels)
  6198. if ($str =~ /[AEIOUY]/) {
  6199. # change all letters but the first to lower case,
  6200. # but only in words containing a vowel
  6201. if ($str =~ s/\b([AEIOUY])([A-Z]+)/$1\L$2/g) {
  6202. $str =~ s/\bAf\b/AF/; # patch for "AF"
  6203. # patch for a number of models that write improper string
  6204. # terminator for ImageStabilization (VR-OFF, VR-ON)
  6205. $str =~ s/ +.$//s;
  6206. }
  6207. if ($str =~ s/\b([A-Z])([A-Z]*[AEIOUY][A-Z]*)/$1\L$2/g) {
  6208. $str =~ s/\bRaw\b/RAW/; # patch for "RAW"
  6209. }
  6210. }
  6211. }
  6212. return $str;
  6213. }
  6214. #------------------------------------------------------------------------------
  6215. # decoding tables from ref 4
  6216. my @xlat = (
  6217. [ 0xc1,0xbf,0x6d,0x0d,0x59,0xc5,0x13,0x9d,0x83,0x61,0x6b,0x4f,0xc7,0x7f,0x3d,0x3d,
  6218. 0x53,0x59,0xe3,0xc7,0xe9,0x2f,0x95,0xa7,0x95,0x1f,0xdf,0x7f,0x2b,0x29,0xc7,0x0d,
  6219. 0xdf,0x07,0xef,0x71,0x89,0x3d,0x13,0x3d,0x3b,0x13,0xfb,0x0d,0x89,0xc1,0x65,0x1f,
  6220. 0xb3,0x0d,0x6b,0x29,0xe3,0xfb,0xef,0xa3,0x6b,0x47,0x7f,0x95,0x35,0xa7,0x47,0x4f,
  6221. 0xc7,0xf1,0x59,0x95,0x35,0x11,0x29,0x61,0xf1,0x3d,0xb3,0x2b,0x0d,0x43,0x89,0xc1,
  6222. 0x9d,0x9d,0x89,0x65,0xf1,0xe9,0xdf,0xbf,0x3d,0x7f,0x53,0x97,0xe5,0xe9,0x95,0x17,
  6223. 0x1d,0x3d,0x8b,0xfb,0xc7,0xe3,0x67,0xa7,0x07,0xf1,0x71,0xa7,0x53,0xb5,0x29,0x89,
  6224. 0xe5,0x2b,0xa7,0x17,0x29,0xe9,0x4f,0xc5,0x65,0x6d,0x6b,0xef,0x0d,0x89,0x49,0x2f,
  6225. 0xb3,0x43,0x53,0x65,0x1d,0x49,0xa3,0x13,0x89,0x59,0xef,0x6b,0xef,0x65,0x1d,0x0b,
  6226. 0x59,0x13,0xe3,0x4f,0x9d,0xb3,0x29,0x43,0x2b,0x07,0x1d,0x95,0x59,0x59,0x47,0xfb,
  6227. 0xe5,0xe9,0x61,0x47,0x2f,0x35,0x7f,0x17,0x7f,0xef,0x7f,0x95,0x95,0x71,0xd3,0xa3,
  6228. 0x0b,0x71,0xa3,0xad,0x0b,0x3b,0xb5,0xfb,0xa3,0xbf,0x4f,0x83,0x1d,0xad,0xe9,0x2f,
  6229. 0x71,0x65,0xa3,0xe5,0x07,0x35,0x3d,0x0d,0xb5,0xe9,0xe5,0x47,0x3b,0x9d,0xef,0x35,
  6230. 0xa3,0xbf,0xb3,0xdf,0x53,0xd3,0x97,0x53,0x49,0x71,0x07,0x35,0x61,0x71,0x2f,0x43,
  6231. 0x2f,0x11,0xdf,0x17,0x97,0xfb,0x95,0x3b,0x7f,0x6b,0xd3,0x25,0xbf,0xad,0xc7,0xc5,
  6232. 0xc5,0xb5,0x8b,0xef,0x2f,0xd3,0x07,0x6b,0x25,0x49,0x95,0x25,0x49,0x6d,0x71,0xc7 ],
  6233. [ 0xa7,0xbc,0xc9,0xad,0x91,0xdf,0x85,0xe5,0xd4,0x78,0xd5,0x17,0x46,0x7c,0x29,0x4c,
  6234. 0x4d,0x03,0xe9,0x25,0x68,0x11,0x86,0xb3,0xbd,0xf7,0x6f,0x61,0x22,0xa2,0x26,0x34,
  6235. 0x2a,0xbe,0x1e,0x46,0x14,0x68,0x9d,0x44,0x18,0xc2,0x40,0xf4,0x7e,0x5f,0x1b,0xad,
  6236. 0x0b,0x94,0xb6,0x67,0xb4,0x0b,0xe1,0xea,0x95,0x9c,0x66,0xdc,0xe7,0x5d,0x6c,0x05,
  6237. 0xda,0xd5,0xdf,0x7a,0xef,0xf6,0xdb,0x1f,0x82,0x4c,0xc0,0x68,0x47,0xa1,0xbd,0xee,
  6238. 0x39,0x50,0x56,0x4a,0xdd,0xdf,0xa5,0xf8,0xc6,0xda,0xca,0x90,0xca,0x01,0x42,0x9d,
  6239. 0x8b,0x0c,0x73,0x43,0x75,0x05,0x94,0xde,0x24,0xb3,0x80,0x34,0xe5,0x2c,0xdc,0x9b,
  6240. 0x3f,0xca,0x33,0x45,0xd0,0xdb,0x5f,0xf5,0x52,0xc3,0x21,0xda,0xe2,0x22,0x72,0x6b,
  6241. 0x3e,0xd0,0x5b,0xa8,0x87,0x8c,0x06,0x5d,0x0f,0xdd,0x09,0x19,0x93,0xd0,0xb9,0xfc,
  6242. 0x8b,0x0f,0x84,0x60,0x33,0x1c,0x9b,0x45,0xf1,0xf0,0xa3,0x94,0x3a,0x12,0x77,0x33,
  6243. 0x4d,0x44,0x78,0x28,0x3c,0x9e,0xfd,0x65,0x57,0x16,0x94,0x6b,0xfb,0x59,0xd0,0xc8,
  6244. 0x22,0x36,0xdb,0xd2,0x63,0x98,0x43,0xa1,0x04,0x87,0x86,0xf7,0xa6,0x26,0xbb,0xd6,
  6245. 0x59,0x4d,0xbf,0x6a,0x2e,0xaa,0x2b,0xef,0xe6,0x78,0xb6,0x4e,0xe0,0x2f,0xdc,0x7c,
  6246. 0xbe,0x57,0x19,0x32,0x7e,0x2a,0xd0,0xb8,0xba,0x29,0x00,0x3c,0x52,0x7d,0xa8,0x49,
  6247. 0x3b,0x2d,0xeb,0x25,0x49,0xfa,0xa3,0xaa,0x39,0xa7,0xc5,0xa7,0x50,0x11,0x36,0xfb,
  6248. 0xc6,0x67,0x4a,0xf5,0xa5,0x12,0x65,0x7e,0xb0,0xdf,0xaf,0x4e,0xb3,0x61,0x7f,0x2f ]
  6249. );
  6250. # Decrypt Nikon data block (ref 4)
  6251. # Inputs: 0) reference to data block, 1) serial number key, 2) shutter count key
  6252. # 4) optional start offset (default 0)
  6253. # 5) optional number of bytes to decode (default to the end of the data)
  6254. # Returns: data block with specified data decrypted
  6255. sub Decrypt($$$;$$)
  6256. {
  6257. my ($dataPt, $serial, $count, $start, $len) = @_;
  6258. my ($i, $dat);
  6259. $start or $start = 0;
  6260. my $maxLen = length($$dataPt) - $start;
  6261. $len = $maxLen if not defined $len or $len > $maxLen;
  6262. return $$dataPt if $len <= 0;
  6263. my $key = 0;
  6264. for ($i=0; $i<4; ++$i) {
  6265. $key ^= ($count >> ($i*8)) & 0xff;
  6266. }
  6267. my $ci = $xlat[0][$serial & 0xff];
  6268. my $cj = $xlat[1][$key];
  6269. my $ck = 0x60;
  6270. my @data = unpack("x${start}C$len", $$dataPt);
  6271. foreach $dat (@data) {
  6272. $cj = ($cj + $ci * $ck) & 0xff;
  6273. $ck = ($ck + 1) & 0xff;
  6274. $dat ^= $cj;
  6275. }
  6276. my $end = $start + $len;
  6277. my $pre = $start ? substr($$dataPt, 0, $start) : '';
  6278. my $post = $end < length($$dataPt) ? substr($$dataPt, $end) : '';
  6279. return $pre . pack('C*',@data) . $post;
  6280. }
  6281. #------------------------------------------------------------------------------
  6282. # Get serial number for use as a decryption key
  6283. # Inputs: 0) ExifTool object ref, 1) serial number string
  6284. # Returns: serial key integer or undef if no serial number provided
  6285. sub SerialKey($$)
  6286. {
  6287. my ($et, $serial) = @_;
  6288. # use serial number as key if integral
  6289. return $serial if not defined $serial or $serial =~ /^\d+$/;
  6290. return 0x22 if $$et{Model} =~ /\bD50$/; # D50 (ref 8)
  6291. return 0x60; # D200 (ref 10), D40X (ref PH), etc
  6292. }
  6293. #------------------------------------------------------------------------------
  6294. # Read Nikon NCTG tags in MOV videos
  6295. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  6296. # Returns: 1 on success
  6297. sub ProcessNikonMOV($$$)
  6298. {
  6299. my ($et, $dirInfo, $tagTablePtr) = @_;
  6300. my $dataPt = $$dirInfo{DataPt};
  6301. my $dataPos = $$dirInfo{DataPos};
  6302. my $pos = $$dirInfo{DirStart};
  6303. my $end = $pos + $$dirInfo{DirLen};
  6304. $et->VerboseDir($$dirInfo{DirName}, 0, $$dirInfo{DirLen});
  6305. while ($pos + 8 < $end) {
  6306. my $tag = Get32u($dataPt, $pos);
  6307. my $fmt = Get16u($dataPt, $pos + 4); # (same format code as EXIF)
  6308. my $count = Get16u($dataPt, $pos + 6);
  6309. $pos += 8;
  6310. my $fmtStr = $Image::ExifTool::Exif::formatName[$fmt];
  6311. unless ($fmtStr) {
  6312. $et->Warn(sprintf("Unknown format ($fmt) for $$dirInfo{DirName} tag 0x%x",$tag));
  6313. last;
  6314. }
  6315. my $size = $count * $Image::ExifTool::Exif::formatSize[$fmt];
  6316. if ($pos + $size > $end) {
  6317. $et->Warn(sprintf("Truncated data for $$dirInfo{DirName} tag 0x%x",$tag));
  6318. last;
  6319. }
  6320. my $rational;
  6321. my $val = ReadValue($dataPt, $pos, $fmtStr, $count, $size, \$rational);
  6322. my $key = $et->HandleTag($tagTablePtr, $tag, $val,
  6323. DataPt => $dataPt,
  6324. DataPos => $dataPos,
  6325. Format => $fmtStr,
  6326. Start => $pos,
  6327. Size => $size,
  6328. );
  6329. $$et{RATIONAL}{$key} = $rational if $rational and $key;
  6330. $pos += $size; # is this padded to an even offset????
  6331. }
  6332. return 1;
  6333. }
  6334. #------------------------------------------------------------------------------
  6335. # Read/Write Nikon Encrypted data block
  6336. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  6337. # Returns: 1 on success when reading, or new directory when writing (IsWriting set)
  6338. sub ProcessNikonEncrypted($$$)
  6339. {
  6340. my ($et, $dirInfo, $tagTablePtr) = @_;
  6341. $et or return 1; # allow dummy access
  6342. my $serial = $$et{NikonSerialKey};
  6343. my $count = $$et{NikonCountKey};
  6344. unless (defined $serial and defined $count) {
  6345. if (defined $serial or defined $count) {
  6346. my $missing = defined $serial ? 'ShutterCount' : 'SerialNumber';
  6347. $et->Warn("Can't decrypt Nikon information (no $missing key)");
  6348. }
  6349. delete $$et{NikonSerialKey};
  6350. delete $$et{NikonCountKey};
  6351. return 0;
  6352. }
  6353. my $verbose = $$dirInfo{IsWriting} ? 0 : $et->Options('Verbose');
  6354. my $tagInfo = $$dirInfo{TagInfo};
  6355. my $dirStart = $$dirInfo{DirStart};
  6356. my $data = substr(${$$dirInfo{DataPt}}, $dirStart, $$dirInfo{DirLen});
  6357. my ($start, $len, $more, $offset, $byteOrder, $recrypt, $newSerial, $newCount);
  6358. # must re-encrypt when writing if serial number or shutter count changes
  6359. if ($$dirInfo{IsWriting}) {
  6360. if ($$et{NewNikonSerialKey}) {
  6361. $newSerial = $$et{NewNikonSerialKey};
  6362. $recrypt = 1;
  6363. }
  6364. if ($$et{NewNikonCountKey}) {
  6365. $newCount = $$et{NewNikonCountKey};
  6366. $recrypt = 1;
  6367. }
  6368. }
  6369. if ($tagInfo and $$tagInfo{SubDirectory}) {
  6370. $start = $$tagInfo{SubDirectory}{DecryptStart};
  6371. # may decrypt only part of the information to save time
  6372. if ($verbose < 3 and $et->Options('Unknown') < 2 and not $recrypt) {
  6373. $len = $$tagInfo{SubDirectory}{DecryptLen};
  6374. $more = $$tagInfo{SubDirectory}{DecryptMore};
  6375. }
  6376. $offset = $$tagInfo{SubDirectory}{DirOffset};
  6377. $byteOrder = $$tagInfo{SubDirectory}{ByteOrder};
  6378. }
  6379. $start or $start = 0;
  6380. if (defined $offset) {
  6381. # offset, if specified, is relative to start of encrypted data
  6382. $offset += $start;
  6383. } else {
  6384. $offset = 0;
  6385. }
  6386. my $maxLen = length($data) - $start;
  6387. # decrypt all the data unless DecryptLen is given
  6388. unless ($len and $len < $maxLen) {
  6389. $len = $maxLen;
  6390. undef $more; # (can't decrypt more than this)
  6391. }
  6392. $data = Decrypt(\$data, $serial, $count, $start, $len);
  6393. # set appropriate byte ordering before evaluating DecryptMore
  6394. my $oldOrder = GetByteOrder();
  6395. SetByteOrder($byteOrder) if $byteOrder;
  6396. if ($more) {
  6397. #### eval DecryptMore ($data)
  6398. my $moreLen = eval $more;
  6399. $moreLen = $maxLen if $moreLen > $maxLen;
  6400. # re-decrypt with new length
  6401. if ($len < $moreLen) {
  6402. $len = $moreLen;
  6403. $data = substr(${$$dirInfo{DataPt}}, $dirStart, $$dirInfo{DirLen});
  6404. $data = Decrypt(\$data, $serial, $count, $start, $len);
  6405. }
  6406. }
  6407. if ($verbose > 2) {
  6408. $et->VerboseDir("Decrypted $$tagInfo{Name}");
  6409. $et->VerboseDump(\$data,
  6410. Prefix => $$et{INDENT} . ' ',
  6411. DataPos => $dirStart + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
  6412. );
  6413. }
  6414. # process the decrypted information
  6415. my %subdirInfo = (
  6416. DataPt => \$data,
  6417. DirStart => $offset,
  6418. DirLen => length($data) - $offset,
  6419. DirName => $$dirInfo{DirName},
  6420. DataPos => $$dirInfo{DataPos} + $dirStart,
  6421. Base => $$dirInfo{Base},
  6422. );
  6423. my $rtnVal;
  6424. if ($$dirInfo{IsWriting}) {
  6425. my $changed = $$et{CHANGED};
  6426. $rtnVal = $et->WriteBinaryData(\%subdirInfo, $tagTablePtr);
  6427. # must re-encrypt if serial number or shutter count changes
  6428. if ($recrypt) {
  6429. $serial = $newSerial if defined $newSerial;
  6430. $count = $newCount if defined $newCount;
  6431. ++$$et{CHANGED};
  6432. }
  6433. if ($changed == $$et{CHANGED}) {
  6434. undef $rtnVal; # nothing changed so use original data
  6435. } else {
  6436. # add back any un-encrypted data at start
  6437. $rtnVal = substr($data, 0, $offset) . $rtnVal if $offset;
  6438. # re-encrypt data (symmetrical algorithm)
  6439. $rtnVal = Decrypt(\$rtnVal, $serial, $count, $start, $len);
  6440. }
  6441. } else {
  6442. $rtnVal = $et->ProcessBinaryData(\%subdirInfo, $tagTablePtr);
  6443. }
  6444. SetByteOrder($oldOrder);
  6445. return $rtnVal;
  6446. }
  6447. #------------------------------------------------------------------------------
  6448. # Pre-scan EXIF directory to extract specific tags
  6449. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) required tagID hash ref
  6450. # Returns: 1 if directory was scanned successfully
  6451. sub PrescanExif($$$)
  6452. {
  6453. my ($et, $dirInfo, $tagHash) = @_;
  6454. my $dataPt = $$dirInfo{DataPt};
  6455. my $dataPos = $$dirInfo{DataPos} || 0;
  6456. my $dataLen = $$dirInfo{DataLen};
  6457. my $dirStart = $$dirInfo{DirStart} || 0;
  6458. my $base = $$dirInfo{Base} || 0;
  6459. my $raf = $$dirInfo{RAF};
  6460. my ($index, $numEntries, $data, $buff);
  6461. # get number of entries in IFD
  6462. if ($dirStart >= 0 and $dirStart <= $dataLen-2) {
  6463. $numEntries = Get16u($dataPt, $dirStart);
  6464. # reset $numEntries to read from file if necessary
  6465. undef $numEntries if $dirStart + 2 + 12 * $numEntries > $dataLen;
  6466. }
  6467. # read IFD from file if necessary
  6468. unless ($numEntries) {
  6469. $raf or return 0;
  6470. $dataPos += $dirStart; # read data from the start of the directory
  6471. $raf->Seek($dataPos + $base, 0) and $raf->Read($data, 2) == 2 or return 0;
  6472. $numEntries = Get16u(\$data, 0);
  6473. my $len = 12 * $numEntries;
  6474. $raf->Read($buff, $len) == $len or return 0;
  6475. $data .= $buff;
  6476. # update variables for the newly loaded IFD (already updated dataPos)
  6477. $dataPt = \$data;
  6478. $dataLen = length $data;
  6479. $dirStart = 0;
  6480. }
  6481. # loop through necessary IFD entries
  6482. my ($lastTag) = sort { $b <=> $a } keys %$tagHash; # (reverse sort)
  6483. for ($index=0; $index<$numEntries; ++$index) {
  6484. my $entry = $dirStart + 2 + 12 * $index;
  6485. my $tagID = Get16u($dataPt, $entry);
  6486. last if $tagID > $lastTag; # (assuming tags are in order)
  6487. next unless exists $$tagHash{$tagID}; # only extract required tags
  6488. my $format = Get16u($dataPt, $entry+2);
  6489. next if $format < 1 or $format > 13;
  6490. my $count = Get32u($dataPt, $entry+4);
  6491. my $size = $count * $Image::ExifTool::Exif::formatSize[$format];
  6492. my $formatStr = $Image::ExifTool::Exif::formatName[$format];
  6493. my $valuePtr = $entry + 8; # pointer to value within $$dataPt
  6494. if ($size > 4) {
  6495. next if $size > 0x1000000; # set a reasonable limit on data size (16MB)
  6496. $valuePtr = Get32u($dataPt, $valuePtr);
  6497. # convert offset to pointer in $$dataPt
  6498. # (don't yet handle EntryBased or FixOffsets)
  6499. $valuePtr -= $dataPos;
  6500. if ($valuePtr < 0 or $valuePtr+$size > $dataLen) {
  6501. next unless $raf and $raf->Seek($base + $valuePtr + $dataPos,0) and
  6502. $raf->Read($buff,$size) == $size;
  6503. $$tagHash{$tagID} = ReadValue(\$buff,0,$formatStr,$count,$size);
  6504. next;
  6505. }
  6506. }
  6507. $$tagHash{$tagID} = ReadValue($dataPt,$valuePtr,$formatStr,$count,$size);
  6508. }
  6509. return 1;
  6510. }
  6511. #------------------------------------------------------------------------------
  6512. # Process Nikon Capture history data
  6513. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  6514. # Returns: 1 on success
  6515. sub ProcessNikonCaptureEditVersions($$$)
  6516. {
  6517. my ($et, $dirInfo, $tagTablePtr) = @_;
  6518. require Image::ExifTool::NikonCapture;
  6519. return Image::ExifTool::NikonCapture::ProcessNikonCaptureEditVersions($et, $dirInfo, $tagTablePtr);
  6520. }
  6521. #------------------------------------------------------------------------------
  6522. # Process Nikon Capture Offsets IFD (ref PH)
  6523. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  6524. # Returns: 1 on success
  6525. # Notes: This isn't a normal IFD, but is close...
  6526. sub ProcessNikonCaptureOffsets($$$)
  6527. {
  6528. my ($et, $dirInfo, $tagTablePtr) = @_;
  6529. my $dataPt = $$dirInfo{DataPt};
  6530. my $dirStart = $$dirInfo{DirStart};
  6531. my $dirLen = $$dirInfo{DirLen};
  6532. my $success = 0;
  6533. return 0 unless $dirLen > 2;
  6534. my $count = Get16u($dataPt, $dirStart);
  6535. return 0 unless $count and $count * 12 + 2 <= $dirLen;
  6536. if ($et->Options('Verbose')) {
  6537. $et->VerboseDir('NikonCaptureOffsets', $count);
  6538. }
  6539. my $index;
  6540. for ($index=0; $index<$count; ++$index) {
  6541. my $pos = $dirStart + 12 * $index + 2;
  6542. my $tagID = Get32u($dataPt, $pos);
  6543. my $value = Get32u($dataPt, $pos + 4);
  6544. $et->HandleTag($tagTablePtr, $tagID, $value,
  6545. Index => $index,
  6546. DataPt => $dataPt,
  6547. Start => $pos,
  6548. Size => 12,
  6549. ) and $success = 1;
  6550. }
  6551. return $success;
  6552. }
  6553. #------------------------------------------------------------------------------
  6554. # Read/write Nikon MakerNotes directory
  6555. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  6556. # Returns: 1 on success, otherwise returns 0 and sets a Warning when reading
  6557. # or new directory when writing (IsWriting set in dirInfo)
  6558. sub ProcessNikon($$$)
  6559. {
  6560. my ($et, $dirInfo, $tagTablePtr) = @_;
  6561. $et or return 1; # allow dummy access
  6562. # pre-scan IFD to get SerialNumber (0x001d) and ShutterCount (0x00a7) for use in decryption
  6563. my %needTags = ( 0x001d => 0, 0x00a7 => undef );
  6564. PrescanExif($et, $dirInfo, \%needTags);
  6565. $$et{NikonSerialKey} = SerialKey($et, $needTags{0x001d});
  6566. $$et{NikonCountKey} = $needTags{0x00a7};
  6567. # process Nikon makernotes
  6568. my $rtnVal;
  6569. if ($$dirInfo{IsWriting}) {
  6570. # get new decryptino keys if they are being changed
  6571. my $serial = $et->GetNewValue($Image::ExifTool::Nikon::Main{0x001d});
  6572. my $count = $et->GetNewValue($Image::ExifTool::Nikon::Main{0x00a7});
  6573. $$et{NewNikonSerialKey} = SerialKey($et, $serial);
  6574. $$et{NewNikonCountKey} = $count;
  6575. $rtnVal = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
  6576. delete $$et{NewNikonSerialKey};
  6577. delete $$et{NewNikonCountKey};
  6578. } else {
  6579. $rtnVal = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
  6580. }
  6581. delete $$et{NikonSerialKey};
  6582. delete $$et{NikonCountKey};
  6583. return $rtnVal;
  6584. }
  6585. 1; # end
  6586. __END__
  6587. =head1 NAME
  6588. Image::ExifTool::Nikon - Nikon EXIF maker notes tags
  6589. =head1 SYNOPSIS
  6590. This module is loaded automatically by Image::ExifTool when required.
  6591. =head1 DESCRIPTION
  6592. This module contains definitions required by Image::ExifTool to interpret
  6593. Nikon maker notes in EXIF information.
  6594. =head1 AUTHOR
  6595. Copyright 2003-2016, Phil Harvey (phil at owl.phy.queensu.ca)
  6596. This library is free software; you can redistribute it and/or modify it
  6597. under the same terms as Perl itself.
  6598. =head1 REFERENCES
  6599. =over 4
  6600. =item L<http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html>
  6601. =item L<http://www.cybercom.net/~dcoffin/dcraw/>
  6602. =item L<http://members.aol.com/khancock/pilot/nbuddy/>
  6603. =item L<http://www.rottmerhusen.com/objektives/lensid/thirdparty.html>
  6604. =item L<http://homepage3.nifty.com/kamisaka/makernote/makernote_nikon.htm>
  6605. =item L<http://www.wohlberg.net/public/software/photo/nstiffexif/>
  6606. =item (...plus lots of testing with Best Buy store demos!)
  6607. =back
  6608. =head1 ACKNOWLEDGEMENTS
  6609. Thanks to Joseph Heled, Thomas Walter, Brian Ristuccia, Danek Duvall, Tom
  6610. Christiansen, Robert Rottmerhusen, Werner Kober, Roger Larsson, Jens Duttke,
  6611. Gregor Dorlars, Neil Nappe, Alexandre Naaman, Brendt Wohlberg and Warren
  6612. Hatch for their help figuring out some Nikon tags, and to everyone who
  6613. helped contribute to the LensID list.
  6614. =head1 SEE ALSO
  6615. L<Image::ExifTool::TagNames/Nikon Tags>,
  6616. L<Image::ExifTool::TagNames/NikonCapture Tags>,
  6617. L<Image::ExifTool(3pm)|Image::ExifTool>
  6618. =cut