PageRenderTime 90ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/Image-ExifTool-8.90/lib/Image/ExifTool/Canon.pm

#
Perl | 7148 lines | 6468 code | 115 blank | 565 comment | 145 complexity | 5bdb43d01f1630302f42e83d1fb1995e MD5 | raw file
  1. #------------------------------------------------------------------------------
  2. # File: Canon.pm
  3. #
  4. # Description: Canon EXIF maker notes tags
  5. #
  6. # Revisions: 11/25/2003 - P. Harvey Created
  7. # 12/03/2003 - P. Harvey Decode lots more tags and add CanonAFInfo
  8. # 02/17/2004 - Michael Rommel Added IxusAFPoint
  9. # 01/27/2005 - P. Harvey Disable validation of CanonAFInfo
  10. # 01/30/2005 - P. Harvey Added a few more tags (ref 4)
  11. # 02/10/2006 - P. Harvey Decode a lot of new tags (ref 12)
  12. # [ongoing] - P. Harvey Constantly decoding new information
  13. #
  14. # Notes: Must check FocalPlaneX/YResolution values for each new model!
  15. #
  16. # References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
  17. # 2) Michael Rommel private communication (Digital Ixus)
  18. # 3) Daniel Pittman private communication (PowerShot S70)
  19. # 4) http://www.wonderland.org/crw/
  20. # 5) Juha Eskelinen private communication (20D)
  21. # 6) Richard S. Smith private communication (20D)
  22. # 7) Denny Priebe private communication (1DmkII)
  23. # 8) Irwin Poche private communication
  24. # 9) Michael Tiemann private communication (1DmkII)
  25. # 10) Volker Gering private communication (1DmkII)
  26. # 11) "cip" private communication
  27. # 12) Rainer Honle private communication (5D)
  28. # 13) http://www.cybercom.net/~dcoffin/dcraw/
  29. # 14) (bozi) http://www.cpanforum.com/threads/2476 and /2563
  30. # 15) http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm (2007/11/19)
  31. # + http://homepage3.nifty.com/kamisaka/makernote/CanonLens.htm (2007/11/19)
  32. # 16) Emil Sit private communication (30D)
  33. # 17) http://www.asahi-net.or.jp/~xp8t-ymzk/s10exif.htm
  34. # 18) Samson Tai private communication (G7)
  35. # 19) Warren Stockton private communication
  36. # 20) Bogdan private communication
  37. # 21) Heiko Hinrichs private communication
  38. # 22) Dave Nicholson private communication (PowerShot S30)
  39. # 23) Magne Nilsen private communication (400D)
  40. # 24) Wolfgang Hoffmann private communication (40D)
  41. # 26) Steve Balcombe private communication
  42. # 27) Chris Huebsch private communication (40D)
  43. # 28) Hal Williamson private communication (XTi)
  44. # 29) Ger Vermeulen private communication
  45. # 30) David Pitcher private communication (1DmkIII)
  46. # 31) Darryl Zurn private communication (A590IS)
  47. # 32) Rich Taylor private communication (5D)
  48. # 33) D.J. Cristi private communication
  49. # 34) Andreas Huggel and Pascal de Bruijn private communication
  50. # 35) Jan Boelsma private communication
  51. # 36) Karl-Heinz Klotz private communication (http://www.dslr-forum.de/showthread.php?t=430900)
  52. # 37) Vesa Kivisto private communication (30D)
  53. # 38) Kurt Garloff private communication (5DmkII)
  54. # 39) Irwin Poche private communication (5DmkII)
  55. # 40) Jose Oliver-Didier private communication
  56. # 41) http://www.cpanforum.com/threads/10730
  57. # 42) Norbert Wasser private communication
  58. # 43) Karsten Sote private communication
  59. # 44) Hugh Griffiths private communication (5DmkII)
  60. # 45) Mark Berger private communication (5DmkII)
  61. # 46) Dieter Steiner private communication (7D)
  62. # 47) http://www.exiv2.org/
  63. # 48) Tomasz A. Kawecki private communication (550D, firmware 1.0.6, 1.0.8)
  64. # 49) http://www.listware.net/201101/digikam-users/49795-digikam-users-re-lens-recognition.html
  65. # 50) http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3833.0.html
  66. # JD) Jens Duttke private communication
  67. #------------------------------------------------------------------------------
  68. package Image::ExifTool::Canon;
  69. use strict;
  70. use vars qw($VERSION %canonModelID %canonLensTypes);
  71. use Image::ExifTool qw(:DataAccess :Utils);
  72. use Image::ExifTool::Exif;
  73. sub WriteCanon($$$);
  74. sub ProcessSerialData($$$);
  75. sub ProcessFilters($$$);
  76. sub SwapWords($);
  77. $VERSION = '2.91';
  78. # Note: Removed 'USM' from 'L' lenses since it is redundant - PH
  79. # (or is it? Ref 32 shows 5 non-USM L-type lenses)
  80. # --> have relaxed this for new lenses because Canon has been
  81. # consistent about keeping "USM" in the model name
  82. %canonLensTypes = ( #4
  83. Notes => q{
  84. Decimal values differentiate lenses which would otherwise have the same
  85. LensType, and are used by the Composite LensID tag when attempting to
  86. identify the specific lens model.
  87. },
  88. 1 => 'Canon EF 50mm f/1.8',
  89. 2 => 'Canon EF 28mm f/2.8',
  90. # (3 removed in current Kamisaka list)
  91. 3 => 'Canon EF 135mm f/2.8 Soft', #15/32
  92. 4 => 'Canon EF 35-105mm f/3.5-4.5 or Sigma Lens', #28
  93. 4.1 => 'Sigma UC Zoom 35-135mm f/4-5.6',
  94. 5 => 'Canon EF 35-70mm f/3.5-4.5', #32
  95. 6 => 'Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens', #32
  96. 6.1 => 'Sigma 18-50mm f/3.5-5.6 DC', #23
  97. 6.2 => 'Sigma 18-125mm f/3.5-5.6 DC IF ASP',
  98. 6.3 => 'Tokina AF193-2 19-35mm f/3.5-4.5',
  99. 6.4 => 'Sigma 28-80mm f/3.5-5.6 II Macro', #47
  100. 7 => 'Canon EF 100-300mm f/5.6L', #15
  101. 8 => 'Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens', #32
  102. 8.1 => 'Sigma 70-300mm f/4-5.6 [APO] DG Macro', #15 (both APO and non-APO, ref http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2947.0.html)
  103. 8.2 => 'Tokina AT-X242AF 24-200mm f/3.5-5.6', #15
  104. 9 => 'Canon EF 70-210mm f/4', #32
  105. 9.1 => 'Sigma 55-200mm f/4-5.6 DC', #34
  106. 10 => 'Canon EF 50mm f/2.5 Macro or Sigma Lens', #10 (+ LSC Life Size Converter --> 70mm - PH)
  107. 10.1 => 'Sigma 50mm f/2.8 EX', #4
  108. 10.2 => 'Sigma 28mm f/1.8',
  109. 10.3 => 'Sigma 105mm f/2.8 Macro EX', #15
  110. 10.4 => 'Sigma 70mm f/2.8 EX DG Macro EF', #Jean-Michel Dubois
  111. 11 => 'Canon EF 35mm f/2', #9
  112. 13 => 'Canon EF 15mm f/2.8 Fisheye', #9
  113. 14 => 'Canon EF 50-200mm f/3.5-4.5L', #32
  114. 15 => 'Canon EF 50-200mm f/3.5-4.5', #32
  115. 16 => 'Canon EF 35-135mm f/3.5-4.5', #32
  116. 17 => 'Canon EF 35-70mm f/3.5-4.5A', #32
  117. 18 => 'Canon EF 28-70mm f/3.5-4.5', #32
  118. 20 => 'Canon EF 100-200mm f/4.5A', #32
  119. 21 => 'Canon EF 80-200mm f/2.8L',
  120. 22 => 'Canon EF 20-35mm f/2.8L or Tokina Lens', #32
  121. 22.1 => 'Tokina AT-X280AF PRO 28-80mm f/2.8 Aspherical', #15
  122. 23 => 'Canon EF 35-105mm f/3.5-4.5', #32
  123. 24 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
  124. 25 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
  125. 26 => 'Canon EF 100mm f/2.8 Macro or Other Lens',
  126. 26.1 => 'Cosina 100mm f/3.5 Macro AF',
  127. 26.2 => 'Tamron SP AF 90mm f/2.8 Di Macro', #15
  128. 26.3 => 'Tamron SP AF 180mm f/3.5 Di Macro', #15
  129. 26.4 => 'Carl Zeiss Planar T* 50mm f/1.4', #PH
  130. 27 => 'Canon EF 35-80mm f/4-5.6', #32
  131. # 27 => 'Carl Zeiss Distagon T* 28mm f/2 ZF', #PH (must be with an adapter, because the ZF version is a Nikon mount)
  132. # 27 => 'EMF adapter for Canon EOS digital cameras', #50 (reports LongFocal of 65535)
  133. 28 => 'Canon EF 80-200mm f/4.5-5.6 or Tamron Lens', #32
  134. 28.1 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF', #15
  135. 28.2 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #4
  136. 28.3 => 'Tamron AF 70-300mm f/4.5-5.6 Di LD 1:2 Macro Zoom', #11
  137. 28.4 => 'Tamron AF Aspherical 28-200mm f/3.8-5.6', #14
  138. 29 => 'Canon EF 50mm f/1.8 II',
  139. 30 => 'Canon EF 35-105mm f/4.5-5.6', #32
  140. 31 => 'Canon EF 75-300mm f/4-5.6 or Tamron Lens', #32
  141. 31.1 => 'Tamron SP AF 300mm f/2.8 LD IF', #15
  142. 32 => 'Canon EF 24mm f/2.8 or Sigma Lens', #10
  143. 32.1 => 'Sigma 15mm f/2.8 EX Fisheye', #11
  144. 33 => 'Voigtlander or Carl Zeiss Lens',
  145. 33.1 => 'Voigtlander Ultron 40mm f/2 SLII Aspherical', #45
  146. 33.2 => 'Carl Zeiss Distagon T* 15mm f/2.8 ZE', #PH
  147. 33.3 => 'Carl Zeiss Distagon T* 18mm f/3.5 ZE', #PH
  148. 33.4 => 'Carl Zeiss Distagon T* 21mm f/2.8 ZE', #PH
  149. 33.5 => 'Carl Zeiss Distagon T* 28mm f/2 ZE', #PH
  150. 33.6 => 'Carl Zeiss Distagon T* 35mm f/2 ZE', #PH
  151. 35 => 'Canon EF 35-80mm f/4-5.6', #32
  152. 36 => 'Canon EF 38-76mm f/4.5-5.6', #32
  153. 37 => 'Canon EF 35-80mm f/4-5.6 or Tamron Lens', #32
  154. 37.1 => 'Tamron 70-200mm f/2.8 Di LD IF Macro', #PH
  155. 37.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20', #38
  156. 37.3 => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]', #34
  157. 37.4 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2937.0.html
  158. 38 => 'Canon EF 80-200mm f/4.5-5.6', #32
  159. 39 => 'Canon EF 75-300mm f/4-5.6',
  160. 40 => 'Canon EF 28-80mm f/3.5-5.6',
  161. 41 => 'Canon EF 28-90mm f/4-5.6', #32
  162. 42 => 'Canon EF 28-200mm f/3.5-5.6 or Tamron Lens', #32
  163. 42.1 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20', #15
  164. 43 => 'Canon EF 28-105mm f/4-5.6', #10
  165. 44 => 'Canon EF 90-300mm f/4.5-5.6', #32
  166. 45 => 'Canon EF-S 18-55mm f/3.5-5.6 [II]', #PH (same ID for version II, ref 20)
  167. 46 => 'Canon EF 28-90mm f/4-5.6', #32
  168. 48 => 'Canon EF-S 18-55mm f/3.5-5.6 IS', #20
  169. 49 => 'Canon EF-S 55-250mm f/4-5.6 IS', #23
  170. 50 => 'Canon EF-S 18-200mm f/3.5-5.6 IS',
  171. 51 => 'Canon EF-S 18-135mm f/3.5-5.6 IS', #PH
  172. 52 => 'Canon EF-S 18-55mm f/3.5-5.6 IS II', #PH
  173. 53 => 'Canon EF-S 18-55mm f/3.5-5.6 III', #Jon Charnas
  174. 94 => 'Canon TS-E 17mm f/4L', #42
  175. 95 => 'Canon TS-E 24.0mm f/3.5 L II', #43
  176. 124 => 'Canon MP-E 65mm f/2.8 1-5x Macro Photo', #9
  177. 125 => 'Canon TS-E 24mm f/3.5L',
  178. 126 => 'Canon TS-E 45mm f/2.8', #15
  179. 127 => 'Canon TS-E 90mm f/2.8', #15
  180. 129 => 'Canon EF 300mm f/2.8L', #32
  181. 130 => 'Canon EF 50mm f/1.0L', #10/15
  182. 131 => 'Canon EF 28-80mm f/2.8-4L or Sigma Lens', #32
  183. 131.1 => 'Sigma 8mm f/3.5 EX DG Circular Fisheye', #15
  184. 131.2 => 'Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM', #15
  185. 131.3 => 'Sigma 17-70mm f/2.8-4.5 DC Macro', #PH (NC)
  186. 131.4 => 'Sigma APO 50-150mm f/2.8 [II] EX DC HSM', #15 ([II] ref PH)
  187. 131.5 => 'Sigma APO 120-300mm f/2.8 EX DG HSM', #15
  188. # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 1.4x', #15
  189. # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 2x', #15
  190. 131.6 => 'Sigma 4.5mm F2.8 EX DC HSM Circular Fisheye', #PH
  191. 132 => 'Canon EF 1200mm f/5.6L', #32
  192. 134 => 'Canon EF 600mm f/4L IS', #15
  193. 135 => 'Canon EF 200mm f/1.8L',
  194. 136 => 'Canon EF 300mm f/2.8L',
  195. 137 => 'Canon EF 85mm f/1.2L or Sigma or Tamron Lens', #10
  196. 137.1 => 'Sigma 18-50mm f/2.8-4.5 DC OS HSM', #PH
  197. 137.2 => 'Sigma 50-200mm f/4-5.6 DC OS HSM', #PH
  198. 137.3 => 'Sigma 18-250mm f/3.5-6.3 DC OS HSM', #PH
  199. 137.4 => 'Sigma 24-70mm f/2.8 IF EX DG HSM', #PH
  200. 137.5 => 'Sigma 18-125mm f/3.8-5.6 DC OS HSM', #PH
  201. 137.6 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2819.0.html
  202. 137.7 => 'Sigma 17-50mm f/2.8 OS HSM', #PH (from Exiv2)
  203. 137.8 => 'Sigma 18-200mm f/3.5-6.3 II DC OS HSM', #PH
  204. 137.9 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD', #(model B008)http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3090.0.html
  205. '137.10' => 'Sigma 8-16mm f/4.5-5.6 DC HSM', #50-Zwielicht
  206. '137.11' => 'Tamron SP 17-50mm f/2.8 XR Di II VC', #50 (model B005)
  207. '137.12' => 'Tamron SP 60mm f/2 Macro Di II', #50 (model G005)
  208. '137.13' => 'Sigma 10-20mm f/3.5 EX DC HSM', #Gerald Erdmann
  209. 138 => 'Canon EF 28-80mm f/2.8-4L', #32
  210. 139 => 'Canon EF 400mm f/2.8L',
  211. 140 => 'Canon EF 500mm f/4.5L', #32
  212. 141 => 'Canon EF 500mm f/4.5L',
  213. 142 => 'Canon EF 300mm f/2.8L IS', #15
  214. 143 => 'Canon EF 500mm f/4L IS', #15
  215. 144 => 'Canon EF 35-135mm f/4-5.6 USM', #26
  216. 145 => 'Canon EF 100-300mm f/4.5-5.6 USM', #32
  217. 146 => 'Canon EF 70-210mm f/3.5-4.5 USM', #32
  218. 147 => 'Canon EF 35-135mm f/4-5.6 USM', #32
  219. 148 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
  220. 149 => 'Canon EF 100mm f/2 USM', #9
  221. 150 => 'Canon EF 14mm f/2.8L or Sigma Lens', #10
  222. 150.1 => 'Sigma 20mm EX f/1.8', #4
  223. 150.2 => 'Sigma 30mm f/1.4 DC HSM', #15
  224. 150.3 => 'Sigma 24mm f/1.8 DG Macro EX', #15
  225. 151 => 'Canon EF 200mm f/2.8L',
  226. 152 => 'Canon EF 300mm f/4L IS or Sigma Lens', #15
  227. 152.1 => 'Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM', #15
  228. 152.2 => 'Sigma 14mm f/2.8 EX Aspherical HSM', #15
  229. 152.3 => 'Sigma 10-20mm f/4-5.6', #14
  230. 152.4 => 'Sigma 100-300mm f/4', # (ref Bozi)
  231. 153 => 'Canon EF 35-350mm f/3.5-5.6L or Sigma or Tamron Lens', #PH
  232. 153.1 => 'Sigma 50-500mm f/4-6.3 APO HSM EX', #15
  233. 153.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro',
  234. 153.3 => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14', #15
  235. 153.4 => 'Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro', #PH
  236. 154 => 'Canon EF 20mm f/2.8 USM', #15
  237. 155 => 'Canon EF 85mm f/1.8 USM',
  238. 156 => 'Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens',
  239. 156.1 => 'Tamron SP 70-300mm f/4.0-5.6 Di VC USD', #PH (model A005)
  240. 160 => 'Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens',
  241. 160.1 => 'Tamron AF 19-35mm f/3.5-4.5', #44
  242. 160.2 => 'Tokina AT-X 124 AF 12-24mm f/4 DX', #49 (not sure about specific model - PH)
  243. 160.3 => 'Tokina AT-X 107 AF DX 10-17mm f/3.5-4.5 Fisheye', #PH (http://osdir.com/ml/digikam-devel/2011-04/msg00275.html)
  244. 160.4 => 'Tokina AF 11-16mm f/2.8 AT-X Pro DX', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3967.0.html
  245. 161 => 'Canon EF 28-70mm f/2.8L or Sigma or Tamron Lens',
  246. 161.1 => 'Sigma 24-70mm f/2.8 EX',
  247. 161.2 => 'Sigma 28-70mm f/2.8 EX', #PH (http://www.breezesys.com/forum/showthread.php?t=3718)
  248. 161.3 => 'Tamron AF 17-50mm f/2.8 Di-II LD Aspherical', #40
  249. 161.4 => 'Tamron 90mm f/2.8',
  250. 162 => 'Canon EF 200mm f/2.8L', #32
  251. 163 => 'Canon EF 300mm f/4L', #32
  252. 164 => 'Canon EF 400mm f/5.6L', #32
  253. 165 => 'Canon EF 70-200mm f/2.8 L',
  254. 166 => 'Canon EF 70-200mm f/2.8 L + 1.4x',
  255. 167 => 'Canon EF 70-200mm f/2.8 L + 2x',
  256. 168 => 'Canon EF 28mm f/1.8 USM', #15
  257. 169 => 'Canon EF 17-35mm f/2.8L or Sigma Lens', #15
  258. 169.1 => 'Sigma 18-200mm f/3.5-6.3 DC OS', #23
  259. 169.2 => 'Sigma 15-30mm f/3.5-4.5 EX DG Aspherical', #4
  260. 169.3 => 'Sigma 18-50mm f/2.8 Macro', #26
  261. 169.4 => 'Sigma 50mm f/1.4 EX DG HSM', #PH
  262. 169.5 => 'Sigma 85mm f/1.4 EX DG HSM', #Rolando Ruzic
  263. 169.6 => 'Sigma 30mm f/1.4 EX DC HSM', #Rodolfo Borges
  264. 170 => 'Canon EF 200mm f/2.8L II', #9
  265. 171 => 'Canon EF 300mm f/4L', #15
  266. 172 => 'Canon EF 400mm f/5.6L', #32
  267. 173 => 'Canon EF 180mm Macro f/3.5L or Sigma Lens', #9
  268. 173.1 => 'Sigma 180mm EX HSM Macro f/3.5', #14
  269. 173.2 => 'Sigma APO Macro 150mm f/2.8 EX DG HSM', #14
  270. 174 => 'Canon EF 135mm f/2L or Sigma Lens', #9
  271. 174.1 => 'Sigma 70-200mm f/2.8 EX DG APO OS HSM', #PH (probably version II of this lens)
  272. 174.2 => 'Sigma 50-500mm f/4.5-6.3 APO DG OS HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4031.0.html
  273. 175 => 'Canon EF 400mm f/2.8L', #32
  274. 176 => 'Canon EF 24-85mm f/3.5-4.5 USM',
  275. 177 => 'Canon EF 300mm f/4L IS', #9
  276. 178 => 'Canon EF 28-135mm f/3.5-5.6 IS',
  277. 179 => 'Canon EF 24mm f/1.4L', #20
  278. 180 => 'Canon EF 35mm f/1.4L', #9
  279. 181 => 'Canon EF 100-400mm f/4.5-5.6L IS + 1.4x', #15
  280. 182 => 'Canon EF 100-400mm f/4.5-5.6L IS + 2x',
  281. 183 => 'Canon EF 100-400mm f/4.5-5.6L IS or Sigma Lens',
  282. 183.1 => 'Sigma 150mm f/2.8 EX DG OS HSM APO Macro', #50
  283. 184 => 'Canon EF 400mm f/2.8L + 2x', #15
  284. 185 => 'Canon EF 600mm f/4L IS', #32
  285. 186 => 'Canon EF 70-200mm f/4L', #9
  286. 187 => 'Canon EF 70-200mm f/4L + 1.4x', #26
  287. 188 => 'Canon EF 70-200mm f/4L + 2x', #PH
  288. 189 => 'Canon EF 70-200mm f/4L + 2.8x', #32
  289. 190 => 'Canon EF 100mm f/2.8 Macro',
  290. 191 => 'Canon EF 400mm f/4 DO IS', #9
  291. 193 => 'Canon EF 35-80mm f/4-5.6 USM', #32
  292. 194 => 'Canon EF 80-200mm f/4.5-5.6 USM', #32
  293. 195 => 'Canon EF 35-105mm f/4.5-5.6 USM', #32
  294. 196 => 'Canon EF 75-300mm f/4-5.6 USM', #15/32
  295. 197 => 'Canon EF 75-300mm f/4-5.6 IS USM',
  296. 198 => 'Canon EF 50mm f/1.4 USM', #9
  297. 199 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
  298. 200 => 'Canon EF 75-300mm f/4-5.6 USM', #32
  299. 201 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
  300. 202 => 'Canon EF 28-80mm f/3.5-5.6 USM IV',
  301. 208 => 'Canon EF 22-55mm f/4-5.6 USM', #32
  302. 209 => 'Canon EF 55-200mm f/4.5-5.6', #32
  303. 210 => 'Canon EF 28-90mm f/4-5.6 USM', #32
  304. 211 => 'Canon EF 28-200mm f/3.5-5.6 USM', #15
  305. 212 => 'Canon EF 28-105mm f/4-5.6 USM', #15
  306. 213 => 'Canon EF 90-300mm f/4.5-5.6 USM',
  307. 214 => 'Canon EF-S 18-55mm f/3.5-5.6 USM', #PH/34
  308. 215 => 'Canon EF 55-200mm f/4.5-5.6 II USM',
  309. 224 => 'Canon EF 70-200mm f/2.8L IS', #11
  310. 225 => 'Canon EF 70-200mm f/2.8L IS + 1.4x', #11
  311. 226 => 'Canon EF 70-200mm f/2.8L IS + 2x', #14
  312. 227 => 'Canon EF 70-200mm f/2.8L IS + 2.8x', #32
  313. 228 => 'Canon EF 28-105mm f/3.5-4.5 USM', #32
  314. 229 => 'Canon EF 16-35mm f/2.8L', #PH
  315. 230 => 'Canon EF 24-70mm f/2.8L', #9
  316. 231 => 'Canon EF 17-40mm f/4L',
  317. 232 => 'Canon EF 70-300mm f/4.5-5.6 DO IS USM', #15
  318. 233 => 'Canon EF 28-300mm f/3.5-5.6L IS', #PH
  319. 234 => 'Canon EF-S 17-85mm f4-5.6 IS USM', #19
  320. 235 => 'Canon EF-S 10-22mm f/3.5-4.5 USM', #15
  321. 236 => 'Canon EF-S 60mm f/2.8 Macro USM', #15
  322. 237 => 'Canon EF 24-105mm f/4L IS', #15
  323. 238 => 'Canon EF 70-300mm f/4-5.6 IS USM', #15
  324. 239 => 'Canon EF 85mm f/1.2L II', #15
  325. 240 => 'Canon EF-S 17-55mm f/2.8 IS USM', #15
  326. 241 => 'Canon EF 50mm f/1.2L', #15
  327. 242 => 'Canon EF 70-200mm f/4L IS', #PH
  328. 243 => 'Canon EF 70-200mm f/4L IS + 1.4x', #15
  329. 244 => 'Canon EF 70-200mm f/4L IS + 2x', #PH
  330. 245 => 'Canon EF 70-200mm f/4L IS + 2.8x', #32
  331. 246 => 'Canon EF 16-35mm f/2.8L II', #PH
  332. 247 => 'Canon EF 14mm f/2.8L II USM', #32
  333. 248 => 'Canon EF 200mm f/2L IS', #42
  334. 249 => 'Canon EF 800mm f/5.6L IS', #35
  335. 250 => 'Canon EF 24 f/1.4L II', #41
  336. 251 => 'Canon EF 70-200mm f/2.8L IS II USM',
  337. 252 => 'Canon EF 70-200mm f/2.8L IS II USM + 1.4x', #50 (1.4x Mk II)
  338. 253 => 'Canon EF 70-200mm f/2.8L IS II USM + 2x', #PH (NC)
  339. 254 => 'Canon EF 100mm f/2.8L Macro IS USM', #42
  340. # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
  341. 488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
  342. 489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
  343. 490 => 'Canon EF 8-15mm f/4L USM', #Klaus Reinfeld
  344. 491 => 'Canon EF 300mm f/2.8L IS II USM', #42
  345. );
  346. # Canon model ID numbers (PH)
  347. %canonModelID = (
  348. 0x1010000 => 'PowerShot A30',
  349. 0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
  350. 0x1060000 => 'PowerShot A20',
  351. 0x1080000 => 'PowerShot A10',
  352. 0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
  353. 0x1100000 => 'PowerShot G2',
  354. 0x1110000 => 'PowerShot S40',
  355. 0x1120000 => 'PowerShot S30',
  356. 0x1130000 => 'PowerShot A40',
  357. 0x1140000 => 'EOS D30',
  358. 0x1150000 => 'PowerShot A100',
  359. 0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
  360. 0x1170000 => 'PowerShot A200',
  361. 0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
  362. 0x1190000 => 'PowerShot G3',
  363. 0x1210000 => 'PowerShot S45',
  364. 0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
  365. 0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
  366. 0x1250000 => 'PowerShot A70',
  367. 0x1260000 => 'PowerShot A60',
  368. 0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
  369. 0x1290000 => 'PowerShot G5',
  370. 0x1300000 => 'PowerShot A300',
  371. 0x1310000 => 'PowerShot S50',
  372. 0x1340000 => 'PowerShot A80',
  373. 0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
  374. 0x1360000 => 'PowerShot S1 IS',
  375. 0x1370000 => 'PowerShot Pro1',
  376. 0x1380000 => 'PowerShot S70',
  377. 0x1390000 => 'PowerShot S60',
  378. 0x1400000 => 'PowerShot G6',
  379. 0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
  380. 0x1420000 => 'PowerShot A75',
  381. 0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
  382. 0x1450000 => 'PowerShot A400',
  383. 0x1470000 => 'PowerShot A310',
  384. 0x1490000 => 'PowerShot A85',
  385. 0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
  386. 0x1530000 => 'PowerShot A95',
  387. 0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
  388. 0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
  389. 0x1560000 => 'PowerShot A520',
  390. 0x1570000 => 'PowerShot A510',
  391. 0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
  392. 0x1640000 => 'PowerShot S2 IS',
  393. 0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
  394. 0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
  395. 0x1668000 => 'EOS D60',
  396. 0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
  397. 0x1740000 => 'PowerShot A430',
  398. 0x1750000 => 'PowerShot A410',
  399. 0x1760000 => 'PowerShot S80',
  400. 0x1780000 => 'PowerShot A620',
  401. 0x1790000 => 'PowerShot A610',
  402. 0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
  403. 0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
  404. 0x1820000 => 'PowerShot TX1',
  405. 0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
  406. 0x1880000 => 'PowerShot A420',
  407. 0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
  408. 0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
  409. 0x1920000 => 'PowerShot A700',
  410. 0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
  411. 0x1950000 => 'PowerShot S3 IS',
  412. 0x1960000 => 'PowerShot A540',
  413. 0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
  414. 0x1980000 => 'PowerShot G7',
  415. 0x1990000 => 'PowerShot A530',
  416. 0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
  417. 0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
  418. 0x2020000 => 'PowerShot A710 IS',
  419. 0x2030000 => 'PowerShot A640',
  420. 0x2040000 => 'PowerShot A630',
  421. 0x2090000 => 'PowerShot S5 IS',
  422. 0x2100000 => 'PowerShot A460',
  423. 0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
  424. 0x2130000 => 'PowerShot A570 IS',
  425. 0x2140000 => 'PowerShot A560',
  426. 0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
  427. 0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
  428. 0x2180000 => 'PowerShot A550',
  429. 0x2190000 => 'PowerShot A450',
  430. 0x2230000 => 'PowerShot G9',
  431. 0x2240000 => 'PowerShot A650 IS',
  432. 0x2260000 => 'PowerShot A720 IS',
  433. 0x2290000 => 'PowerShot SX100 IS',
  434. 0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
  435. 0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
  436. 0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
  437. 0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
  438. 0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
  439. 0x2380000 => 'PowerShot A590 IS',
  440. 0x2390000 => 'PowerShot A580',
  441. 0x2420000 => 'PowerShot A470',
  442. 0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
  443. 0x2460000 => 'PowerShot SX1 IS',
  444. 0x2470000 => 'PowerShot SX10 IS',
  445. 0x2480000 => 'PowerShot A1000 IS',
  446. 0x2490000 => 'PowerShot G10',
  447. 0x2510000 => 'PowerShot A2000 IS',
  448. 0x2520000 => 'PowerShot SX110 IS',
  449. 0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
  450. 0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
  451. 0x2550000 => 'PowerShot E1',
  452. 0x2560000 => 'PowerShot D10',
  453. 0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
  454. 0x2580000 => 'PowerShot A2100 IS',
  455. 0x2590000 => 'PowerShot A480',
  456. 0x2600000 => 'PowerShot SX200 IS',
  457. 0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
  458. 0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
  459. 0x2630000 => 'PowerShot A1100 IS',
  460. 0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
  461. 0x2700000 => 'PowerShot G11',
  462. 0x2710000 => 'PowerShot SX120 IS',
  463. 0x2720000 => 'PowerShot S90',
  464. 0x2750000 => 'PowerShot SX20 IS',
  465. 0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
  466. 0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
  467. 0x2800000 => 'PowerShot A495',
  468. 0x2810000 => 'PowerShot A490',
  469. 0x2820000 => 'PowerShot A3100 IS / A3150 IS', # (different cameras, same ID)
  470. 0x2830000 => 'PowerShot A3000 IS',
  471. 0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
  472. 0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
  473. 0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
  474. 0x2870000 => 'PowerShot SX210 IS',
  475. 0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
  476. 0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
  477. 0x2920000 => 'PowerShot G12',
  478. 0x2930000 => 'PowerShot SX30 IS',
  479. 0x2940000 => 'PowerShot SX130 IS',
  480. 0x2950000 => 'PowerShot S95',
  481. 0x2980000 => 'PowerShot A3300 IS',
  482. 0x2990000 => 'PowerShot A3200 IS',
  483. 0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
  484. 0x3010000 => 'PowerShot Pro90 IS',
  485. 0x3010001 => 'PowerShot A800',
  486. 0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
  487. 0x3030000 => 'PowerShot SX230 HS',
  488. 0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
  489. 0x3050000 => 'PowerShot A2200',
  490. 0x3060000 => 'PowerShot A1200',
  491. 0x3070000 => 'PowerShot SX220 HS',
  492. 0x3080000 => 'PowerShot G1 X',
  493. 0x3090000 => 'PowerShot SX150 IS',
  494. 0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
  495. 0x3110000 => 'PowerShot S100 (new)',
  496. 0x3130000 => 'PowerShot SX40 HS',
  497. 0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
  498. 0x3140000 => 'PowerShot ELPH 500 HS / IXUS 320 HS / IXY 32S', # (duplicate PowerShot model???)
  499. 0x3160000 => 'PowerShot A1300',
  500. 0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
  501. 0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
  502. 0x3200000 => 'PowerShot D20',
  503. 0x3210000 => 'PowerShot A4000 IS',
  504. 0x3220000 => 'PowerShot SX260 HS',
  505. 0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
  506. 0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
  507. 0x3260000 => 'PowerShot A3400 IS',
  508. 0x3270000 => 'PowerShot A2400 IS',
  509. 0x3280000 => 'PowerShot A2300',
  510. 0x4040000 => 'PowerShot G1',
  511. 0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
  512. 0x4007d673 => 'DC19/DC21/DC22',
  513. 0x4007d674 => 'XH A1',
  514. 0x4007d675 => 'HV10',
  515. 0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
  516. 0x4007d777 => 'DC50', # (iVIS)
  517. 0x4007d778 => 'HV20', # (iVIS)
  518. 0x4007d779 => 'DC211', #29
  519. 0x4007d77a => 'HG10',
  520. 0x4007d77b => 'HR10', #29 (iVIS)
  521. 0x4007d77d => 'MD255/ZR950',
  522. 0x4007d81c => 'HF11',
  523. 0x4007d878 => 'HV30',
  524. 0x4007d87c => 'XH A1S',
  525. 0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
  526. 0x4007d87f => 'FS100',
  527. 0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
  528. 0x4007d882 => 'HG20/HG21', # (VIXIA)
  529. 0x4007d925 => 'HF21', # (LEGRIA)
  530. 0x4007d926 => 'HF S11', # (LEGRIA)
  531. 0x4007d978 => 'HV40', # (LEGRIA)
  532. 0x4007d987 => 'DC410/DC411/DC420',
  533. 0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
  534. 0x4007d989 => 'HF20/HF200', # (LEGRIA)
  535. 0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
  536. 0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
  537. 0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
  538. 0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
  539. 0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
  540. # NOTE: some pre-production models may have a model name of
  541. # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
  542. # This has been observed for the 1DSmkIII/K215 and 400D/K236.
  543. 0x80000001 => 'EOS-1D',
  544. 0x80000167 => 'EOS-1DS',
  545. 0x80000168 => 'EOS 10D',
  546. 0x80000169 => 'EOS-1D Mark III',
  547. 0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
  548. 0x80000174 => 'EOS-1D Mark II',
  549. 0x80000175 => 'EOS 20D',
  550. 0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
  551. 0x80000188 => 'EOS-1Ds Mark II',
  552. 0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
  553. 0x80000190 => 'EOS 40D',
  554. 0x80000213 => 'EOS 5D',
  555. 0x80000215 => 'EOS-1Ds Mark III',
  556. 0x80000218 => 'EOS 5D Mark II',
  557. 0x80000219 => 'WFT-E1',
  558. 0x80000232 => 'EOS-1D Mark II N',
  559. 0x80000234 => 'EOS 30D',
  560. 0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
  561. 0x80000241 => 'WFT-E2',
  562. 0x80000246 => 'WFT-E3',
  563. 0x80000250 => 'EOS 7D',
  564. 0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
  565. 0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
  566. 0x80000261 => 'EOS 50D',
  567. 0x80000269 => 'EOS-1D X',
  568. 0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
  569. 0x80000271 => 'WFT-E4',
  570. 0x80000273 => 'WFT-E5',
  571. 0x80000281 => 'EOS-1D Mark IV',
  572. 0x80000285 => 'EOS 5D Mark III',
  573. 0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
  574. 0x80000287 => 'EOS 60D',
  575. 0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
  576. 0x80000297 => 'WFT-E2 II',
  577. 0x80000298 => 'WFT-E4 II',
  578. );
  579. my %canonQuality = (
  580. 1 => 'Economy',
  581. 2 => 'Normal',
  582. 3 => 'Fine',
  583. 4 => 'RAW',
  584. 5 => 'Superfine',
  585. 130 => 'Normal Movie', #22
  586. );
  587. my %canonImageSize = (
  588. 0 => 'Large',
  589. 1 => 'Medium',
  590. 2 => 'Small',
  591. 5 => 'Medium 1', #PH
  592. 6 => 'Medium 2', #PH
  593. 7 => 'Medium 3', #PH
  594. 8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
  595. 9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
  596. 10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
  597. 14 => 'Small 1', #PH
  598. 15 => 'Small 2', #PH
  599. 16 => 'Small 3', #PH
  600. 128 => '640x480 Movie', #PH (7D 60fps)
  601. 129 => 'Medium Movie', #22
  602. 130 => 'Small Movie', #22
  603. 137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
  604. 142 => '1920x1080 Movie', #PH (D60 25fps)
  605. );
  606. my %canonWhiteBalance = (
  607. # -1='Click", -2='Pasted' ?? - PH
  608. 0 => 'Auto',
  609. 1 => 'Daylight',
  610. 2 => 'Cloudy',
  611. 3 => 'Tungsten',
  612. 4 => 'Fluorescent',
  613. 5 => 'Flash',
  614. 6 => 'Custom',
  615. 7 => 'Black & White',
  616. 8 => 'Shade',
  617. 9 => 'Manual Temperature (Kelvin)',
  618. 10 => 'PC Set1', #PH
  619. 11 => 'PC Set2', #PH
  620. 12 => 'PC Set3', #PH
  621. 14 => 'Daylight Fluorescent', #3
  622. 15 => 'Custom 1', #PH
  623. 16 => 'Custom 2', #PH
  624. 17 => 'Underwater', #3
  625. 18 => 'Custom 3', #PH
  626. 19 => 'Custom 4', #PH
  627. 20 => 'PC Set4', #PH
  628. 21 => 'PC Set5', #PH
  629. # 22 - Custom 2?
  630. # 23 - Custom 3?
  631. # 30 - Click White Balance?
  632. # 31 - Shot Settings?
  633. # 137 - Tungsten?
  634. # 138 - White Fluorescent?
  635. # 139 - Fluorescent H?
  636. # 140 - Manual?
  637. );
  638. # picture styles used by the 5D
  639. # (styles 0x4X may be downloaded from Canon)
  640. # (called "ColorMatrix" in 1D owner manual)
  641. my %pictureStyles = ( #12
  642. 0x00 => 'None', #PH
  643. 0x01 => 'Standard', #15
  644. 0x02 => 'Portrait', #15
  645. 0x03 => 'High Saturation', #15
  646. 0x04 => 'Adobe RGB', #15
  647. 0x05 => 'Low Saturation', #15
  648. 0x06 => 'CM Set 1', #PH
  649. 0x07 => 'CM Set 2', #PH
  650. # "ColorMatrix" values end here
  651. 0x21 => 'User Def. 1',
  652. 0x22 => 'User Def. 2',
  653. 0x23 => 'User Def. 3',
  654. # "External" styles currently available from Canon are Nostalgia, Clear,
  655. # Twilight and Emerald. The "User Def" styles change to these "External"
  656. # codes when these styles are installed in the camera
  657. 0x41 => 'PC 1', #PH
  658. 0x42 => 'PC 2', #PH
  659. 0x43 => 'PC 3', #PH
  660. 0x81 => 'Standard',
  661. 0x82 => 'Portrait',
  662. 0x83 => 'Landscape',
  663. 0x84 => 'Neutral',
  664. 0x85 => 'Faithful',
  665. 0x86 => 'Monochrome',
  666. 0x87 => 'Auto', #PH
  667. );
  668. my %userDefStyles = ( #12/48
  669. Notes => q{
  670. Base style for user-defined picture styles. PC values represent external
  671. picture styles which may be downloaded from Canon and installed in the
  672. camera.
  673. },
  674. 0x41 => 'PC 1',
  675. 0x42 => 'PC 2',
  676. 0x43 => 'PC 3',
  677. 0x81 => 'Standard',
  678. 0x82 => 'Portrait',
  679. 0x83 => 'Landscape',
  680. 0x84 => 'Neutral',
  681. 0x85 => 'Faithful',
  682. 0x86 => 'Monochrome',
  683. 0x87 => 'Auto', #PH
  684. );
  685. # picture style tag information for CameraInfo550D
  686. my %psConv = (
  687. -559038737 => 'n/a', # = 0xdeadbeef ! LOL
  688. OTHER => sub { return shift },
  689. );
  690. my %psInfo = (
  691. Format => 'int32s',
  692. PrintHex => 1,
  693. PrintConv => \%psConv,
  694. );
  695. # ValueConv that makes long values binary type
  696. my %longBin = (
  697. ValueConv => 'length($val) > 64 ? \$val : $val',
  698. ValueConvInv => '$val',
  699. );
  700. # conversions, etc for CameraColorCalibration tags
  701. my %cameraColorCalibration = (
  702. Format => 'int16s[4]',
  703. Unknown => 1,
  704. PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
  705. PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
  706. );
  707. # conversions, etc for PowerShot CameraColorCalibration tags
  708. my %cameraColorCalibration2 = (
  709. Format => 'int16s[5]',
  710. Unknown => 1,
  711. PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
  712. PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
  713. );
  714. # conversions, etc for byte-swapped FocusDistance tags
  715. my %focusDistanceByteSwap = (
  716. # this is very odd (little-endian number on odd boundary),
  717. # but it does seem to work better with my sample images - PH
  718. Format => 'int16uRev',
  719. ValueConv => '$val / 100',
  720. ValueConvInv => '$val * 100',
  721. PrintConv => '$val > 655.345 ? "inf" : "$val m"',
  722. PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
  723. );
  724. # common attributes for writable BinaryData directories
  725. my %binaryDataAttrs = (
  726. PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
  727. WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
  728. CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
  729. WRITABLE => 1,
  730. );
  731. #------------------------------------------------------------------------------
  732. # Canon EXIF Maker Notes
  733. %Image::ExifTool::Canon::Main = (
  734. WRITE_PROC => \&WriteCanon,
  735. CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
  736. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  737. 0x1 => {
  738. Name => 'CanonCameraSettings',
  739. SubDirectory => {
  740. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  741. TagTable => 'Image::ExifTool::Canon::CameraSettings',
  742. },
  743. },
  744. 0x2 => {
  745. Name => 'CanonFocalLength',
  746. SubDirectory => {
  747. TagTable => 'Image::ExifTool::Canon::FocalLength',
  748. },
  749. },
  750. 0x3 => {
  751. Name => 'CanonFlashInfo',
  752. Unknown => 1,
  753. },
  754. 0x4 => {
  755. Name => 'CanonShotInfo',
  756. SubDirectory => {
  757. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  758. TagTable => 'Image::ExifTool::Canon::ShotInfo',
  759. },
  760. },
  761. 0x5 => {
  762. Name => 'CanonPanorama',
  763. SubDirectory => {
  764. TagTable => 'Image::ExifTool::Canon::Panorama',
  765. },
  766. },
  767. 0x6 => {
  768. Name => 'CanonImageType',
  769. Writable => 'string',
  770. Groups => { 2 => 'Image' },
  771. },
  772. 0x7 => {
  773. Name => 'CanonFirmwareVersion',
  774. Writable => 'string',
  775. },
  776. 0x8 => {
  777. Name => 'FileNumber',
  778. Writable => 'int32u',
  779. Groups => { 2 => 'Image' },
  780. PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
  781. PrintConvInv => '$val=~s/-//g;$val',
  782. },
  783. 0x9 => {
  784. Name => 'OwnerName',
  785. Writable => 'string',
  786. # pad to 32 bytes (including null terminator which will be added)
  787. # to avoid bug which crashes DPP if length is 4 bytes
  788. ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
  789. },
  790. 0xa => {
  791. Name => 'UnknownD30',
  792. SubDirectory => {
  793. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  794. TagTable => 'Image::ExifTool::Canon::UnknownD30',
  795. },
  796. },
  797. 0xc => [ # square brackets for a conditional list
  798. {
  799. # D30
  800. Name => 'SerialNumber',
  801. Condition => '$$self{Model} =~ /EOS D30\b/',
  802. Writable => 'int32u',
  803. PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
  804. PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
  805. },
  806. {
  807. # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
  808. # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
  809. Name => 'SerialNumber',
  810. Condition => '$$self{Model} =~ /EOS-1D/',
  811. Writable => 'int32u',
  812. PrintConv => 'sprintf("%.6u",$val)',
  813. PrintConvInv => '$val',
  814. },
  815. {
  816. # all other models (D60,300D,350D,REBEL,10D,20D,etc)
  817. Name => 'SerialNumber',
  818. Writable => 'int32u',
  819. PrintConv => 'sprintf("%.10u",$val)',
  820. PrintConvInv => '$val',
  821. },
  822. ],
  823. 0xd => [
  824. {
  825. Name => 'CanonCameraInfo1D',
  826. # (save size of this record as "CameraInfoCount" for later tests)
  827. Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
  828. SubDirectory => {
  829. TagTable => 'Image::ExifTool::Canon::CameraInfo1D',
  830. },
  831. },
  832. {
  833. Name => 'CanonCameraInfo1DmkII',
  834. Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
  835. SubDirectory => {
  836. TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII',
  837. },
  838. },
  839. {
  840. Name => 'CanonCameraInfo1DmkIIN',
  841. Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
  842. SubDirectory => {
  843. TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN',
  844. },
  845. },
  846. {
  847. Name => 'CanonCameraInfo1DmkIII',
  848. Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
  849. SubDirectory => {
  850. TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII',
  851. },
  852. },
  853. {
  854. Name => 'CanonCameraInfo1DmkIV',
  855. Condition => '$$self{Model} =~ /\b1D Mark IV$/',
  856. SubDirectory => {
  857. TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV',
  858. },
  859. },
  860. {
  861. Name => 'CanonCameraInfo5D',
  862. Condition => '$$self{Model} =~ /EOS 5D$/',
  863. SubDirectory => {
  864. TagTable => 'Image::ExifTool::Canon::CameraInfo5D',
  865. },
  866. },
  867. {
  868. Name => 'CanonCameraInfo5DmkII',
  869. Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
  870. SubDirectory => {
  871. TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII',
  872. },
  873. },
  874. {
  875. Name => 'CanonCameraInfo7D',
  876. Condition => '$$self{Model} =~ /EOS 7D$/',
  877. SubDirectory => {
  878. TagTable => 'Image::ExifTool::Canon::CameraInfo7D',
  879. },
  880. },
  881. {
  882. Name => 'CanonCameraInfo40D',
  883. Condition => '$$self{Model} =~ /EOS 40D$/',
  884. SubDirectory => {
  885. TagTable => 'Image::ExifTool::Canon::CameraInfo40D',
  886. },
  887. },
  888. {
  889. Name => 'CanonCameraInfo50D',
  890. Condition => '$$self{Model} =~ /EOS 50D$/',
  891. SubDirectory => {
  892. TagTable => 'Image::ExifTool::Canon::CameraInfo50D',
  893. },
  894. },
  895. {
  896. Name => 'CanonCameraInfo60D',
  897. Condition => '$$self{Model} =~ /EOS 60D$/',
  898. SubDirectory => {
  899. TagTable => 'Image::ExifTool::Canon::CameraInfo60D',
  900. },
  901. },
  902. {
  903. Name => 'CanonCameraInfo450D',
  904. Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
  905. SubDirectory => {
  906. TagTable => 'Image::ExifTool::Canon::CameraInfo450D',
  907. },
  908. },
  909. {
  910. Name => 'CanonCameraInfo500D',
  911. Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
  912. SubDirectory => {
  913. TagTable => 'Image::ExifTool::Canon::CameraInfo500D',
  914. },
  915. },
  916. {
  917. Name => 'CanonCameraInfo550D',
  918. Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
  919. SubDirectory => {
  920. TagTable => 'Image::ExifTool::Canon::CameraInfo550D',
  921. },
  922. },
  923. {
  924. Name => 'CanonCameraInfo600D',
  925. Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
  926. SubDirectory => {
  927. TagTable => 'Image::ExifTool::Canon::CameraInfo600D',
  928. },
  929. },
  930. {
  931. Name => 'CanonCameraInfo1000D',
  932. Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
  933. SubDirectory => {
  934. TagTable => 'Image::ExifTool::Canon::CameraInfo1000D',
  935. },
  936. },
  937. {
  938. Name => 'CanonCameraInfo1100D',
  939. Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
  940. SubDirectory => {
  941. TagTable => 'Image::ExifTool::Canon::CameraInfo600D',
  942. },
  943. },
  944. {
  945. Name => 'CanonCameraInfoPowerShot',
  946. # valid if format is int32u[138] or int32u[148]
  947. Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
  948. SubDirectory => {
  949. TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot',
  950. },
  951. },
  952. {
  953. Name => 'CanonCameraInfoPowerShot2',
  954. # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
  955. Condition => q{
  956. $format eq "int32u" and ($count == 156 or $count == 162 or
  957. $count == 167 or $count == 171 or $count == 264)
  958. },
  959. SubDirectory => {
  960. TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2',
  961. },
  962. },
  963. {
  964. Name => 'CanonCameraInfoUnknown32',
  965. Condition => '$format =~ /^int32/',
  966. # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
  967. SubDirectory => {
  968. TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32',
  969. },
  970. },
  971. {
  972. Name => 'CanonCameraInfoUnknown16',
  973. Condition => '$format =~ /^int16/',
  974. SubDirectory => {
  975. TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16',
  976. },
  977. },
  978. {
  979. Name => 'CanonCameraInfoUnknown',
  980. SubDirectory => {
  981. TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown',
  982. },
  983. },
  984. ],
  985. 0xe => {
  986. Name => 'CanonFileLength',
  987. Writable => 'int32u',
  988. Groups => { 2 => 'Image' },
  989. },
  990. 0xf => [
  991. { # used by 1DmkII, 1DSmkII and 1DmkIIN
  992. Name => 'CustomFunctions1D',
  993. Condition => '$$self{Model} =~ /EOS-1D/',
  994. SubDirectory => {
  995. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  996. TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
  997. },
  998. },
  999. {
  1000. Name => 'CustomFunctions5D',
  1001. Condition => '$$self{Model} =~ /EOS 5D/',
  1002. SubDirectory => {
  1003. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1004. TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
  1005. },
  1006. },
  1007. {
  1008. Name => 'CustomFunctions10D',
  1009. Condition => '$$self{Model} =~ /EOS 10D/',
  1010. SubDirectory => {
  1011. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1012. TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
  1013. },
  1014. },
  1015. {
  1016. Name => 'CustomFunctions20D',
  1017. Condition => '$$self{Model} =~ /EOS 20D/',
  1018. SubDirectory => {
  1019. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1020. TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
  1021. },
  1022. },
  1023. {
  1024. Name => 'CustomFunctions30D',
  1025. Condition => '$$self{Model} =~ /EOS 30D/',
  1026. SubDirectory => {
  1027. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1028. TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
  1029. },
  1030. },
  1031. {
  1032. Name => 'CustomFunctions350D',
  1033. Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
  1034. SubDirectory => {
  1035. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1036. TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
  1037. },
  1038. },
  1039. {
  1040. Name => 'CustomFunctions400D',
  1041. Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
  1042. SubDirectory => {
  1043. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1044. TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
  1045. },
  1046. },
  1047. {
  1048. Name => 'CustomFunctionsD30',
  1049. Condition => '$$self{Model} =~ /EOS D30\b/',
  1050. SubDirectory => {
  1051. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1052. TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
  1053. },
  1054. },
  1055. {
  1056. Name => 'CustomFunctionsD60',
  1057. Condition => '$$self{Model} =~ /EOS D60\b/',
  1058. SubDirectory => {
  1059. # the stored size in the D60 apparently doesn't include the size word:
  1060. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
  1061. # (D60 custom functions are basically the same as D30)
  1062. TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
  1063. },
  1064. },
  1065. {
  1066. Name => 'CustomFunctionsUnknown',
  1067. SubDirectory => {
  1068. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1069. TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
  1070. },
  1071. },
  1072. ],
  1073. 0x10 => { #PH
  1074. Name => 'CanonModelID',
  1075. Writable => 'int32u',
  1076. PrintHex => 1,
  1077. SeparateTable => 1,
  1078. PrintConv => \%canonModelID,
  1079. },
  1080. 0x11 => { #PH
  1081. Name => 'MovieInfo',
  1082. SubDirectory => {
  1083. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1084. TagTable => 'Image::ExifTool::Canon::MovieInfo',
  1085. },
  1086. },
  1087. 0x12 => {
  1088. Name => 'CanonAFInfo',
  1089. # not really a condition -- just need to store the count for later
  1090. Condition => '$$self{AFInfoCount} = $count',
  1091. SubDirectory => {
  1092. # this record does not begin with a length word, so it
  1093. # has to be validated differently
  1094. Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
  1095. TagTable => 'Image::ExifTool::Canon::AFInfo',
  1096. },
  1097. },
  1098. 0x13 => { #PH
  1099. Name => 'ThumbnailImageValidArea',
  1100. # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
  1101. Notes => 'all zeros for full frame',
  1102. Writable => 'int16u',
  1103. Count => 4,
  1104. },
  1105. 0x15 => { #PH
  1106. # display format for serial number
  1107. Name => 'SerialNumberFormat',
  1108. Writable => 'int32u',
  1109. PrintHex => 1,
  1110. PrintConv => {
  1111. 0x90000000 => 'Format 1',
  1112. 0xa0000000 => 'Format 2',
  1113. },
  1114. },
  1115. 0x1a => { #15
  1116. Name => 'SuperMacro',
  1117. Writable => 'int16u',
  1118. PrintConv => {
  1119. 0 => 'Off',
  1120. 1 => 'On (1)',
  1121. 2 => 'On (2)',
  1122. },
  1123. },
  1124. 0x1c => { #PH (A570IS)
  1125. Name => 'DateStampMode',
  1126. Writable => 'int16u',
  1127. Notes => 'used only in postcard mode',
  1128. PrintConv => {
  1129. 0 => 'Off',
  1130. 1 => 'Date',
  1131. 2 => 'Date & Time',
  1132. },
  1133. },
  1134. 0x1d => { #PH
  1135. Name => 'MyColors',
  1136. SubDirectory => {
  1137. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1138. TagTable => 'Image::ExifTool::Canon::MyColors',
  1139. },
  1140. },
  1141. 0x1e => { #PH
  1142. Name => 'FirmwareRevision',
  1143. Writable => 'int32u',
  1144. # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
  1145. # A = 'a' for alpha, 'b' for beta?
  1146. # V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
  1147. # R = revision? (01-07, except 00 for alpha/beta releases)
  1148. PrintConv => q{
  1149. my $rev = sprintf("%.8x", $val);
  1150. my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
  1151. my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
  1152. $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
  1153. return "$rel$v1.$v2 rev $r1.$r2",
  1154. },
  1155. PrintConvInv => q{
  1156. $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
  1157. s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
  1158. tr/a-fA-F0-9//dc; return hex $_;
  1159. },
  1160. },
  1161. # 0x1f - used for red-eye-corrected images - PH (A570IS)
  1162. # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
  1163. 0x23 => { #31
  1164. Name => 'Categories',
  1165. Writable => 'int32u',
  1166. Format => 'int32u', # (necessary to perform conversion for Condition)
  1167. Notes => '2 values: 1. always 8, 2. Categories',
  1168. Count => '2',
  1169. Condition => '$$valPt =~ /^\x08\0\0\0/',
  1170. ValueConv => '$val =~ s/^8 //; $val',
  1171. ValueConvInv => '"8 $val"',
  1172. PrintConvColumns => 2,
  1173. PrintConv => { BITMASK => {
  1174. 0 => 'People',
  1175. 1 => 'Scenery',
  1176. 2 => 'Events',
  1177. 3 => 'User 1',
  1178. 4 => 'User 2',
  1179. 5 => 'User 3',
  1180. 6 => 'To Do',
  1181. } },
  1182. },
  1183. 0x24 => { #PH
  1184. Name => 'FaceDetect1',
  1185. SubDirectory => {
  1186. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1187. TagTable => 'Image::ExifTool::Canon::FaceDetect1',
  1188. },
  1189. },
  1190. 0x25 => { #PH
  1191. Name => 'FaceDetect2',
  1192. SubDirectory => {
  1193. TagTable => 'Image::ExifTool::Canon::FaceDetect2',
  1194. },
  1195. },
  1196. 0x26 => { #PH (A570IS,1DmkIII)
  1197. Name => 'CanonAFInfo2',
  1198. Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros in thumbnail of 60D MOV video)
  1199. SubDirectory => {
  1200. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1201. TagTable => 'Image::ExifTool::Canon::AFInfo2',
  1202. },
  1203. },
  1204. # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
  1205. # value 4 is 9 for Flexizone and FaceDetect AF, 1 for Centre AF, 0 otherwise (SX10IS)
  1206. 0x28 => { #JD
  1207. # bytes 0-1=sequence number (encrypted), 2-5=date/time (encrypted) (ref JD)
  1208. Name => 'ImageUniqueID',
  1209. Format => 'undef',
  1210. Writable => 'int8u',
  1211. Groups => { 2 => 'Image' },
  1212. RawConv => '$val eq "\0" x 16 ? undef : $val',
  1213. ValueConv => 'unpack("H*", $val)',
  1214. ValueConvInv => 'pack("H*", $val)',
  1215. },
  1216. # 0x2d - changes with categories (ref 31)
  1217. # 0x44 - ShootInfo
  1218. # 0x62 - UserSetting
  1219. 0x81 => { #13
  1220. Name => 'RawDataOffset',
  1221. # (can't yet write 1D raw files)
  1222. # Writable => 'int32u',
  1223. # Protected => 2,
  1224. },
  1225. 0x83 => { #PH
  1226. Name => 'OriginalDecisionDataOffset',
  1227. Writable => 'int32u',
  1228. OffsetPair => 1, # (just used as a flag, since this tag has no pair)
  1229. # this is an offset to the original decision data block
  1230. # (offset relative to start of file in JPEG images, but NOT DNG images!)
  1231. IsOffset => '$val and $$exifTool{FILE_TYPE} ne "JPEG"',
  1232. Protected => 2,
  1233. DataTag => 'OriginalDecisionData',
  1234. },
  1235. 0x90 => { # used by 1D and 1Ds
  1236. Name => 'CustomFunctions1D',
  1237. SubDirectory => {
  1238. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1239. TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
  1240. },
  1241. },
  1242. 0x91 => { #PH
  1243. Name => 'PersonalFunctions',
  1244. SubDirectory => {
  1245. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1246. TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncs',
  1247. },
  1248. },
  1249. 0x92 => { #PH
  1250. Name => 'PersonalFunctionValues',
  1251. SubDirectory => {
  1252. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1253. TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncValues',
  1254. },
  1255. },
  1256. 0x93 => {
  1257. Name => 'CanonFileInfo', # (ShootInfoEx)
  1258. SubDirectory => {
  1259. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1260. TagTable => 'Image::ExifTool::Canon::FileInfo',
  1261. },
  1262. },
  1263. 0x94 => { #PH
  1264. # AF points for 1D (45 points in 5 rows)
  1265. Name => 'AFPointsInFocus1D',
  1266. Notes => 'EOS 1D -- 5 rows: A1-7, B1-10, C1-11, D1-10, E1-7, center point is C6',
  1267. PrintConv => 'Image::ExifTool::Canon::PrintAFPoints1D($val)',
  1268. },
  1269. 0x95 => { #PH (observed in 5D sample image)
  1270. Name => 'LensModel',
  1271. Writable => 'string',
  1272. },
  1273. 0x96 => [ #PH
  1274. {
  1275. Name => 'SerialInfo',
  1276. Condition => '$$self{Model} =~ /EOS 5D/',
  1277. SubDirectory => { TagTable => 'Image::ExifTool::Canon::SerialInfo' },
  1278. },
  1279. {
  1280. Name => 'InternalSerialNumber',
  1281. Writable => 'string',
  1282. # remove trailing 0xff's if they exist (Kiss X3)
  1283. ValueConv => '$val=~s/\xff+$//; $val',
  1284. ValueConvInv => '$val',
  1285. },
  1286. ],
  1287. 0x97 => { #PH
  1288. Name => 'DustRemovalData',
  1289. Writable => 'undef',
  1290. Flags => [ 'Binary', 'Protected' ],
  1291. # some interesting stuff is stored in here (maybe also InternalSerialNumber)...
  1292. # 0x00: Version
  1293. # 0x01: LensInfo
  1294. # 0x02: AVValue
  1295. # 0x03: POValue
  1296. # 0x04: DustCount
  1297. # 0x06: FocalLength
  1298. # 0x08: LensID
  1299. # 0x0a: Width
  1300. # 0x0c: Height
  1301. # 0x0e: RAW_Width
  1302. # 0x10: RAW_Height
  1303. # 0x12: PixelPitch [um]
  1304. # 0x14: LpfDistance [mm]
  1305. # 0x16: TopOffset
  1306. # 0x17: BottomOffset
  1307. # 0x18: LeftOffset
  1308. # 0x19: RightOffset
  1309. # 0x1a: Year
  1310. # 0x1b: Month
  1311. # 0x1c: Day
  1312. # 0x1d: Hour
  1313. # 0x1e: Minutes
  1314. # 0x1f: BrightDiff
  1315. },
  1316. 0x98 => { #PH
  1317. Name => 'CropInfo',
  1318. SubDirectory => {
  1319. TagTable => 'Image::ExifTool::Canon::CropInfo',
  1320. },
  1321. },
  1322. 0x99 => { #PH (EOS 1D Mark III, 40D, etc)
  1323. Name => 'CustomFunctions2',
  1324. SubDirectory => {
  1325. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1326. TagTable => 'Image::ExifTool::CanonCustom::Functions2',
  1327. },
  1328. },
  1329. 0x9a => { #PH
  1330. Name => 'AspectInfo',
  1331. SubDirectory => {
  1332. TagTable => 'Image::ExifTool::Canon::AspectInfo',
  1333. },
  1334. },
  1335. 0xa0 => {
  1336. Name => 'ProcessingInfo',
  1337. SubDirectory => {
  1338. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1339. TagTable => 'Image::ExifTool::Canon::Processing',
  1340. },
  1341. },
  1342. 0xa1 => { Name => 'ToneCurveTable', %longBin }, #PH
  1343. 0xa2 => { Name => 'SharpnessTable', %longBin }, #PH
  1344. 0xa3 => { Name => 'SharpnessFreqTable', %longBin }, #PH
  1345. 0xa4 => { Name => 'WhiteBalanceTable', %longBin }, #PH
  1346. 0xa9 => {
  1347. Name => 'ColorBalance',
  1348. SubDirectory => {
  1349. # this offset is necessary because the table is interpreted as short rationals
  1350. # (4 bytes long) but the first entry is 2 bytes into the table.
  1351. Start => '$valuePtr + 2',
  1352. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart-2,$size+2)',
  1353. TagTable => 'Image::ExifTool::Canon::ColorBalance',
  1354. },
  1355. },
  1356. 0xaa => {
  1357. Name => 'MeasuredColor',
  1358. SubDirectory => {
  1359. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1360. TagTable => 'Image::ExifTool::Canon::MeasuredColor',
  1361. },
  1362. },
  1363. 0xae => {
  1364. Name => 'ColorTemperature',
  1365. Writable => 'int16u',
  1366. },
  1367. 0xb0 => { #PH
  1368. Name => 'CanonFlags',
  1369. SubDirectory => {
  1370. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1371. TagTable => 'Image::ExifTool::Canon::Flags',
  1372. },
  1373. },
  1374. 0xb1 => { #PH
  1375. Name => 'ModifiedInfo',
  1376. SubDirectory => {
  1377. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1378. TagTable => 'Image::ExifTool::Canon::ModifiedInfo',
  1379. },
  1380. },
  1381. 0xb2 => { Name => 'ToneCurveMatching', %longBin }, #PH
  1382. 0xb3 => { Name => 'WhiteBalanceMatching', %longBin }, #PH
  1383. 0xb4 => { #PH
  1384. Name => 'ColorSpace',
  1385. Writable => 'int16u',
  1386. PrintConv => {
  1387. 1 => 'sRGB',
  1388. 2 => 'Adobe RGB',
  1389. },
  1390. },
  1391. 0xb6 => {
  1392. Name => 'PreviewImageInfo',
  1393. SubDirectory => {
  1394. # Note: the first word of this block gives the correct block size in bytes, but
  1395. # the size is wrong by a factor of 2 in the IFD, so we must account for this
  1396. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size/2)',
  1397. TagTable => 'Image::ExifTool::Canon::PreviewImageInfo',
  1398. },
  1399. },
  1400. 0xd0 => { #PH
  1401. Name => 'VRDOffset',
  1402. Writable => 'int32u',
  1403. OffsetPair => 1, # (just used as a flag, since this tag has no pair)
  1404. Protected => 2,
  1405. DataTag => 'CanonVRD',
  1406. Notes => 'offset of VRD "recipe data" if it exists',
  1407. },
  1408. 0xe0 => { #12
  1409. Name => 'SensorInfo',
  1410. SubDirectory => {
  1411. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1412. TagTable => 'Image::ExifTool::Canon::SensorInfo',
  1413. },
  1414. },
  1415. 0x4001 => [ #13
  1416. { # (int16u[582]) - 20D and 350D
  1417. Condition => '$count == 582',
  1418. Name => 'ColorData1', # (Canon: WBPacket)
  1419. SubDirectory => {
  1420. TagTable => 'Image::ExifTool::Canon::ColorData1',
  1421. },
  1422. },
  1423. { # (int16u[653]) - 1DmkII and 1DSmkII
  1424. Condition => '$count == 653',
  1425. Name => 'ColorData2',
  1426. SubDirectory => {
  1427. TagTable => 'Image::ExifTool::Canon::ColorData2',
  1428. },
  1429. },
  1430. { # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
  1431. Condition => '$count == 796',
  1432. Name => 'ColorData3',
  1433. SubDirectory => {
  1434. TagTable => 'Image::ExifTool::Canon::ColorData3',
  1435. },
  1436. },
  1437. { # (int16u[692|674|702|1227|1250|1251|1337])
  1438. # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
  1439. # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
  1440. # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 1100D (1346)
  1441. Condition => q{
  1442. $count == 692 or $count == 674 or $count == 702 or
  1443. $count == 1227 or $count == 1250 or $count == 1251 or
  1444. $count == 1337 or $count == 1338 or $count == 1346
  1445. },
  1446. Name => 'ColorData4',
  1447. SubDirectory => {
  1448. TagTable => 'Image::ExifTool::Canon::ColorData4',
  1449. },
  1450. },
  1451. { # (int16u[5120]) - G10
  1452. Condition => '$count == 5120',
  1453. Name => 'ColorData5',
  1454. SubDirectory => {
  1455. TagTable => 'Image::ExifTool::Canon::ColorData5',
  1456. },
  1457. },
  1458. { # (int16u[1273]) - 600D
  1459. Condition => '$count == 1273',
  1460. Name => 'ColorData6',
  1461. SubDirectory => {
  1462. TagTable => 'Image::ExifTool::Canon::ColorData6',
  1463. },
  1464. },
  1465. {
  1466. Name => 'ColorDataUnknown',
  1467. SubDirectory => {
  1468. TagTable => 'Image::ExifTool::Canon::ColorDataUnknown',
  1469. },
  1470. },
  1471. ],
  1472. 0x4002 => { #PH
  1473. # unknown data block in some JPEG and CR2 images
  1474. # (5kB for most models, but 22kb for 5D and 30D)
  1475. Name => 'CRWParam',
  1476. Format => 'undef',
  1477. Flags => [ 'Unknown', 'Binary' ],
  1478. },
  1479. 0x4003 => { #PH
  1480. Name => 'ColorInfo',
  1481. SubDirectory => {
  1482. TagTable => 'Image::ExifTool::Canon::ColorInfo',
  1483. },
  1484. },
  1485. 0x4005 => { #PH
  1486. Name => 'Flavor',
  1487. Notes => 'unknown 49kB block, not copied to JPEG images',
  1488. # 'Drop' because not found in JPEG images (too large for APP1 anyway)
  1489. Flags => [ 'Unknown', 'Binary', 'Drop' ],
  1490. },
  1491. 0x4008 => { #PH guess (1DmkIII)
  1492. Name => 'BlackLevel', # (Canon: BasePictStyleOfUser)
  1493. Unknown => 1,
  1494. },
  1495. 0x4010 => { #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2933.0.html
  1496. Name => 'CustomPictureStyleFileName', # (Canon: PictStyleCaption)
  1497. Writable => 'string',
  1498. },
  1499. 0x4013 => { #PH
  1500. Name => 'AFMicroAdj',
  1501. SubDirectory => {
  1502. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1503. TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
  1504. },
  1505. },
  1506. # 0x4014 (similar to 0x83?)
  1507. 0x4015 => {
  1508. Name => 'VignettingCorr', # (Canon: LensPacket)
  1509. Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
  1510. SubDirectory => {
  1511. # (the size word is at byte 2 in this structure)
  1512. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
  1513. TagTable => 'Image::ExifTool::Canon::VignettingCorr',
  1514. },
  1515. },
  1516. 0x4016 => {
  1517. Name => 'VignettingCorr2', # (Canon: ImageCorrectActual)
  1518. SubDirectory => {
  1519. # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
  1520. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1521. TagTable => 'Image::ExifTool::Canon::VignettingCorr2',
  1522. },
  1523. },
  1524. 0x4018 => { #PH
  1525. Name => 'LightingOpt', # (Canon: ImageCorrect)
  1526. SubDirectory => {
  1527. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1528. TagTable => 'Image::ExifTool::Canon::LightingOpt',
  1529. }
  1530. },
  1531. 0x4019 => { #20
  1532. Name => 'LensInfo',
  1533. SubDirectory => {
  1534. TagTable => 'Image::ExifTool::Canon::LensInfo',
  1535. }
  1536. },
  1537. 0x4020 => { #PH
  1538. Name => 'AmbienceInfo',
  1539. Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
  1540. SubDirectory => {
  1541. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1542. TagTable => 'Image::ExifTool::Canon::Ambience',
  1543. }
  1544. },
  1545. 0x4024 => { #PH
  1546. Name => 'FilterInfo',
  1547. SubDirectory => {
  1548. Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
  1549. TagTable => 'Image::ExifTool::Canon::FilterInfo',
  1550. }
  1551. },
  1552. );
  1553. #..............................................................................
  1554. # Canon camera settings (MakerNotes tag 0x01)
  1555. # BinaryData (keys are indices into the int16s array)
  1556. %Image::ExifTool::Canon::CameraSettings = (
  1557. %binaryDataAttrs,
  1558. FORMAT => 'int16s',
  1559. FIRST_ENTRY => 1,
  1560. DATAMEMBER => [ 22, 25 ], # necessary for writing
  1561. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  1562. 1 => {
  1563. Name => 'MacroMode',
  1564. PrintConv => {
  1565. 1 => 'Macro',
  1566. 2 => 'Normal',
  1567. },
  1568. },
  1569. 2 => {
  1570. Name => 'SelfTimer',
  1571. # Custom timer mode if bit 0x4000 is set - PH (A570IS)
  1572. PrintConv => q{
  1573. return 'Off' unless $val;
  1574. return (($val&0xfff) / 10) . ' s' . ($val & 0x4000 ? ', Custom' : '');
  1575. },
  1576. PrintConvInv => q{
  1577. return 0 if $val =~ /^Off/i;
  1578. $val =~ s/\s*s(ec)?\b//i;
  1579. $val =~ s/,?\s*Custom$//i ? ($val*10) | 0x4000 : $val*10;
  1580. },
  1581. },
  1582. 3 => {
  1583. Name => 'Quality',
  1584. PrintConv => \%canonQuality,
  1585. },
  1586. 4 => {
  1587. Name => 'CanonFlashMode',
  1588. PrintConv => {
  1589. 0 => 'Off',
  1590. 1 => 'Auto',
  1591. 2 => 'On',
  1592. 3 => 'Red-eye reduction',
  1593. 4 => 'Slow-sync',
  1594. 5 => 'Red-eye reduction (Auto)',
  1595. 6 => 'Red-eye reduction (On)',
  1596. 16 => 'External flash', # not set in D30 or 300D
  1597. },
  1598. },
  1599. 5 => {
  1600. Name => 'ContinuousDrive',
  1601. PrintConv => {
  1602. 0 => 'Single',
  1603. 1 => 'Continuous',
  1604. 2 => 'Movie', #PH
  1605. 3 => 'Continuous, Speed Priority', #PH
  1606. 4 => 'Continuous, Low', #PH
  1607. 5 => 'Continuous, High', #PH
  1608. 6 => 'Silent Single', #PH
  1609. # 11 - seen for SX260
  1610. # 32-34 - Self-timer?
  1611. },
  1612. },
  1613. 7 => {
  1614. Name => 'FocusMode',
  1615. PrintConv => {
  1616. 0 => 'One-shot AF',
  1617. 1 => 'AI Servo AF',
  1618. 2 => 'AI Focus AF',
  1619. 3 => 'Manual Focus (3)',
  1620. 4 => 'Single',
  1621. 5 => 'Continuous',
  1622. 6 => 'Manual Focus (6)',
  1623. 16 => 'Pan Focus', #PH
  1624. # 137 - Single?
  1625. },
  1626. },
  1627. 9 => { #PH
  1628. Name => 'RecordMode',
  1629. RawConv => '$val==-1 ? undef : $val', #22
  1630. PrintConv => {
  1631. 1 => 'JPEG',
  1632. 2 => 'CRW+THM', # (300D,etc)
  1633. 3 => 'AVI+THM', # (30D)
  1634. 4 => 'TIF', # +THM? (1Ds) (unconfirmed)
  1635. 5 => 'TIF+JPEG', # (1D) (unconfirmed)
  1636. 6 => 'CR2', # +THM? (1D,30D,350D)
  1637. 7 => 'CR2+JPEG', # (S30)
  1638. 9 => 'Video', # (S95 MOV)
  1639. },
  1640. },
  1641. 10 => {
  1642. Name => 'CanonImageSize',
  1643. PrintConvColumns => 2,
  1644. PrintConv => \%canonImageSize,
  1645. },
  1646. 11 => {
  1647. Name => 'EasyMode',
  1648. PrintConvColumns => 3,
  1649. PrintConv => {
  1650. 0 => 'Full auto',
  1651. 1 => 'Manual',
  1652. 2 => 'Landscape',
  1653. 3 => 'Fast shutter',
  1654. 4 => 'Slow shutter',
  1655. 5 => 'Night',
  1656. 6 => 'Gray Scale', #PH
  1657. 7 => 'Sepia',
  1658. 8 => 'Portrait',
  1659. 9 => 'Sports',
  1660. 10 => 'Macro',
  1661. 11 => 'Black & White', #PH
  1662. 12 => 'Pan focus',
  1663. 13 => 'Vivid', #PH
  1664. 14 => 'Neutral', #PH
  1665. 15 => 'Flash Off', #8
  1666. 16 => 'Long Shutter', #PH
  1667. 17 => 'Super Macro', #PH
  1668. 18 => 'Foliage', #PH
  1669. 19 => 'Indoor', #PH
  1670. 20 => 'Fireworks', #PH
  1671. 21 => 'Beach', #PH
  1672. 22 => 'Underwater', #PH
  1673. 23 => 'Snow', #PH
  1674. 24 => 'Kids & Pets', #PH
  1675. 25 => 'Night Snapshot', #PH
  1676. 26 => 'Digital Macro', #PH
  1677. 27 => 'My Colors', #PH
  1678. 28 => 'Movie Snap', #PH
  1679. 29 => 'Super Macro 2', #PH
  1680. 30 => 'Color Accent', #18
  1681. 31 => 'Color Swap', #18
  1682. 32 => 'Aquarium', #18
  1683. 33 => 'ISO 3200', #18
  1684. 34 => 'ISO 6400', #PH
  1685. 35 => 'Creative Light Effect', #PH
  1686. 36 => 'Easy', #PH
  1687. 37 => 'Quick Shot', #PH
  1688. 38 => 'Creative Auto', #39
  1689. 39 => 'Zoom Blur', #PH
  1690. 40 => 'Low Light', #PH
  1691. 41 => 'Nostalgic', #PH
  1692. 42 => 'Super Vivid', #PH (SD4500)
  1693. 43 => 'Poster Effect', #PH (SD4500)
  1694. 44 => 'Face Self-timer', #PH
  1695. 45 => 'Smile', #PH
  1696. 46 => 'Wink Self-timer', #PH
  1697. 47 => 'Fisheye Effect', #PH (SX30IS)
  1698. 48 => 'Miniature Effect', #PH (SD4500)
  1699. 49 => 'High-speed Burst', #PH
  1700. 50 => 'Best Image Selection', #PH
  1701. 51 => 'High Dynamic Range', #PH (S95)
  1702. 52 => 'Handheld Night Scene', #PH
  1703. 53 => 'Movie Digest', #PH
  1704. 54 => 'Live View Control', #PH
  1705. 55 => 'Discreet', #PH
  1706. 56 => 'Blur Reduction', #PH
  1707. 57 => 'Monochrome', #PH (SX260 B&W,Sepia,Blue tone)
  1708. 58 => 'Fisheye', #PH (IXUS240)
  1709. 59 => 'Scene Intelligent Auto', #PH (T3i)
  1710. 60 => 'High Speed Burst HQ', #PH
  1711. 62 => 'Soft Focus', #PH (SX260)
  1712. 257 => 'Spotlight', #PH
  1713. 258 => 'Night 2', #PH
  1714. 259 => 'Night+',
  1715. 260 => 'Super Night', #PH
  1716. 261 => 'Sunset', #PH (SX10IS)
  1717. 263 => 'Night Scene', #PH
  1718. 264 => 'Surface', #PH
  1719. 265 => 'Low Light 2', #PH
  1720. },
  1721. },
  1722. 12 => {
  1723. Name => 'DigitalZoom',
  1724. PrintConv => {
  1725. 0 => 'None',
  1726. 1 => '2x',
  1727. 2 => '4x',
  1728. 3 => 'Other', # value obtained from 2*$val[37]/$val[36]
  1729. },
  1730. },
  1731. 13 => {
  1732. Name => 'Contrast',
  1733. RawConv => '$val == 0x7fff ? undef : $val',
  1734. %Image::ExifTool::Exif::printParameter,
  1735. },
  1736. 14 => {
  1737. Name => 'Saturation',
  1738. RawConv => '$val == 0x7fff ? undef : $val',
  1739. %Image::ExifTool::Exif::printParameter,
  1740. },
  1741. 15 => {
  1742. Name => 'Sharpness',
  1743. RawConv => '$val == 0x7fff ? undef : $val',
  1744. Notes => q{
  1745. some models use a range of -2 to +2 where 0 is normal sharpening, and
  1746. others use a range of 0 to 7 where 0 is no sharpening
  1747. },
  1748. PrintConv => '$val > 0 ? "+$val" : $val',
  1749. PrintConvInv => '$val',
  1750. },
  1751. 16 => {
  1752. Name => 'CameraISO',
  1753. RawConv => '$val == 0x7fff ? undef : $val',
  1754. ValueConv => 'Image::ExifTool::Canon::CameraISO($val)',
  1755. ValueConvInv => 'Image::ExifTool::Canon::CameraISO($val,1)',
  1756. },
  1757. 17 => {
  1758. Name => 'MeteringMode',
  1759. PrintConv => {
  1760. 0 => 'Default', # older Ixus
  1761. 1 => 'Spot',
  1762. 2 => 'Average', #PH
  1763. 3 => 'Evaluative',
  1764. 4 => 'Partial',
  1765. 5 => 'Center-weighted average',
  1766. },
  1767. },
  1768. 18 => {
  1769. # this is always 2 for the 300D - PH
  1770. Name => 'FocusRange',
  1771. PrintConv => {
  1772. 0 => 'Manual',
  1773. 1 => 'Auto',
  1774. 2 => 'Not Known',
  1775. 3 => 'Macro',
  1776. 4 => 'Very Close', #PH
  1777. 5 => 'Close', #PH
  1778. 6 => 'Middle Range', #PH
  1779. 7 => 'Far Range',
  1780. 8 => 'Pan Focus',
  1781. 9 => 'Super Macro', #PH
  1782. 10=> 'Infinity', #PH
  1783. },
  1784. },
  1785. 19 => {
  1786. Name => 'AFPoint',
  1787. Flags => 'PrintHex',
  1788. RawConv => '$val==0 ? undef : $val',
  1789. PrintConv => {
  1790. 0x2005 => 'Manual AF point selection',
  1791. 0x3000 => 'None (MF)',
  1792. 0x3001 => 'Auto AF point selection',
  1793. 0x3002 => 'Right',
  1794. 0x3003 => 'Center',
  1795. 0x3004 => 'Left',
  1796. 0x4001 => 'Auto AF point selection',
  1797. 0x4006 => 'Face Detect', #PH (A570IS)
  1798. },
  1799. },
  1800. 20 => {
  1801. Name => 'CanonExposureMode',
  1802. PrintConv => {
  1803. 0 => 'Easy',
  1804. 1 => 'Program AE',
  1805. 2 => 'Shutter speed priority AE',
  1806. 3 => 'Aperture-priority AE',
  1807. 4 => 'Manual',
  1808. 5 => 'Depth-of-field AE',
  1809. 6 => 'M-Dep', #PH
  1810. 7 => 'Bulb', #30
  1811. },
  1812. },
  1813. 22 => { #4
  1814. Name => 'LensType',
  1815. RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
  1816. Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
  1817. SeparateTable => 1,
  1818. DataMember => 'LensType',
  1819. ValueConvInv => 'int($val)', # (must truncate decimal part)
  1820. PrintConv => \%canonLensTypes,
  1821. },
  1822. 23 => {
  1823. Name => 'LongFocal',
  1824. Format => 'int16u',
  1825. # this is a bit tricky, but we need the FocalUnits to convert this to mm
  1826. RawConvInv => '$val * ($$self{FocalUnits} || 1)',
  1827. ValueConv => '$val / ($$self{FocalUnits} || 1)',
  1828. ValueConvInv => '$val',
  1829. PrintConv => '"$val mm"',
  1830. PrintConvInv => '$val=~s/\s*mm//;$val',
  1831. },
  1832. 24 => {
  1833. Name => 'ShortFocal',
  1834. Format => 'int16u',
  1835. RawConvInv => '$val * ($$self{FocalUnits} || 1)',
  1836. ValueConv => '$val / ($$self{FocalUnits} || 1)',
  1837. ValueConvInv => '$val',
  1838. PrintConv => '"$val mm"',
  1839. PrintConvInv => '$val=~s/\s*mm//;$val',
  1840. },
  1841. 25 => {
  1842. Name => 'FocalUnits',
  1843. # conversion from raw focal length values to mm
  1844. DataMember => 'FocalUnits',
  1845. RawConv => '$$self{FocalUnits} = $val',
  1846. PrintConv => '"$val/mm"',
  1847. PrintConvInv => '$val=~s/\s*\/?\s*mm//;$val',
  1848. },
  1849. 26 => { #9
  1850. Name => 'MaxAperture',
  1851. RawConv => '$val > 0 ? $val : undef',
  1852. ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
  1853. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
  1854. PrintConv => 'sprintf("%.2g",$val)',
  1855. PrintConvInv => '$val',
  1856. },
  1857. 27 => { #PH
  1858. Name => 'MinAperture',
  1859. RawConv => '$val > 0 ? $val : undef',
  1860. ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
  1861. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
  1862. PrintConv => 'sprintf("%.2g",$val)',
  1863. PrintConvInv => '$val',
  1864. },
  1865. 28 => {
  1866. Name => 'FlashActivity',
  1867. RawConv => '$val==-1 ? undef : $val',
  1868. },
  1869. 29 => {
  1870. Name => 'FlashBits',
  1871. PrintConvColumns => 2,
  1872. PrintConv => { BITMASK => {
  1873. 0 => 'Manual', #PH
  1874. 1 => 'TTL', #PH
  1875. 2 => 'A-TTL', #PH
  1876. 3 => 'E-TTL', #PH
  1877. 4 => 'FP sync enabled',
  1878. 7 => '2nd-curtain sync used',
  1879. 11 => 'FP sync used',
  1880. 13 => 'Built-in',
  1881. 14 => 'External', #(may not be set in manual mode - ref 37)
  1882. } },
  1883. },
  1884. 32 => {
  1885. Name => 'FocusContinuous',
  1886. RawConv => '$val==-1 ? undef : $val',
  1887. PrintConv => {
  1888. 0 => 'Single',
  1889. 1 => 'Continuous',
  1890. 8 => 'Manual', #22
  1891. },
  1892. },
  1893. 33 => { #PH
  1894. Name => 'AESetting',
  1895. RawConv => '$val==-1 ? undef : $val',
  1896. PrintConv => {
  1897. 0 => 'Normal AE',
  1898. 1 => 'Exposure Compensation',
  1899. 2 => 'AE Lock',
  1900. 3 => 'AE Lock + Exposure Comp.',
  1901. 4 => 'No AE',
  1902. },
  1903. },
  1904. 34 => { #PH
  1905. Name => 'ImageStabilization',
  1906. RawConv => '$val==-1 ? undef : $val',
  1907. PrintConv => {
  1908. 0 => 'Off',
  1909. 1 => 'On',
  1910. 2 => 'Shoot Only', #15
  1911. 3 => 'Panning', # (A570IS)
  1912. 4 => 'Dynamic', # (SX30IS) (was 'On, Video')
  1913. # (don't know what bit 0x100 indicates)
  1914. 256 => 'Off (2)',
  1915. 257 => 'On (2)',
  1916. 258 => 'Shoot Only (2)',
  1917. 259 => 'Panning (2)',
  1918. 260 => 'Dynamic (2)',
  1919. },
  1920. },
  1921. 35 => { #PH
  1922. Name => 'DisplayAperture',
  1923. RawConv => '$val ? $val : undef',
  1924. ValueConv => '$val / 10',
  1925. ValueConvInv => '$val * 10',
  1926. },
  1927. 36 => 'ZoomSourceWidth', #PH
  1928. 37 => 'ZoomTargetWidth', #PH
  1929. 39 => { #22
  1930. Name => 'SpotMeteringMode',
  1931. RawConv => '$val==-1 ? undef : $val',
  1932. PrintConv => {
  1933. 0 => 'Center',
  1934. 1 => 'AF Point',
  1935. },
  1936. },
  1937. 40 => { #PH
  1938. Name => 'PhotoEffect',
  1939. RawConv => '$val==-1 ? undef : $val',
  1940. PrintConvColumns => 2,
  1941. PrintConv => {
  1942. 0 => 'Off',
  1943. 1 => 'Vivid',
  1944. 2 => 'Neutral',
  1945. 3 => 'Smooth',
  1946. 4 => 'Sepia',
  1947. 5 => 'B&W',
  1948. 6 => 'Custom',
  1949. 100 => 'My Color Data',
  1950. },
  1951. },
  1952. 41 => { #PH (A570IS)
  1953. Name => 'ManualFlashOutput',
  1954. PrintHex => 1,
  1955. PrintConv => {
  1956. 0 => 'n/a',
  1957. 0x500 => 'Full',
  1958. 0x502 => 'Medium',
  1959. 0x504 => 'Low',
  1960. 0x7fff => 'n/a', # (EOS models)
  1961. },
  1962. },
  1963. # 41 => non-zero for manual flash intensity - PH (A570IS)
  1964. 42 => {
  1965. Name => 'ColorTone',
  1966. RawConv => '$val == 0x7fff ? undef : $val',
  1967. %Image::ExifTool::Exif::printParameter,
  1968. },
  1969. 46 => { #PH
  1970. Name => 'SRAWQuality',
  1971. RawConv => '$val==-1 ? undef : $val',
  1972. PrintConv => {
  1973. 0 => 'n/a',
  1974. 1 => 'sRAW1 (mRAW)',
  1975. 2 => 'sRAW2 (sRAW)',
  1976. },
  1977. },
  1978. );
  1979. # focal length information (MakerNotes tag 0x02)
  1980. %Image::ExifTool::Canon::FocalLength = (
  1981. %binaryDataAttrs,
  1982. FORMAT => 'int16u',
  1983. FIRST_ENTRY => 0,
  1984. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  1985. 0 => { #9
  1986. Name => 'FocalType',
  1987. RawConv => '$val ? $val : undef', # don't use if value is zero
  1988. PrintConv => {
  1989. 1 => 'Fixed',
  1990. 2 => 'Zoom',
  1991. },
  1992. },
  1993. 1 => {
  1994. Name => 'FocalLength',
  1995. # the EXIF FocalLength is more reliable, so set this priority to zero
  1996. Priority => 0,
  1997. RawConv => '$val ? $val : undef', # don't use if value is zero
  1998. RawConvInv => q{
  1999. my $focalUnits = $$self{FocalUnits};
  2000. unless ($focalUnits) {
  2001. $focalUnits = 1;
  2002. # (this happens when writing FocalLength to CRW images)
  2003. $self->Warn("FocalUnits not available for FocalLength conversion (1 assumed)");
  2004. }
  2005. return $val * $focalUnits;
  2006. },
  2007. ValueConv => '$val / ($$self{FocalUnits} || 1)',
  2008. ValueConvInv => '$val',
  2009. PrintConv => '"$val mm"',
  2010. PrintConvInv => '$val=~s/\s*mm//;$val',
  2011. },
  2012. 2 => [ #4
  2013. {
  2014. Name => 'FocalPlaneXSize',
  2015. Notes => q{
  2016. these focal plane sizes are only valid for some models, and are affected by
  2017. digital zoom if applied
  2018. },
  2019. # this conversion is valid only for PowerShot models and these EOS models:
  2020. # D30, D60, 1D, 1DS, 5D, 10D, 20D, 30D, 300D, 350D, and 400D
  2021. Condition => q{
  2022. $$self{Model} !~ /EOS/ or
  2023. $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
  2024. $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
  2025. },
  2026. # focal plane image dimensions in 1/1000 inch -- convert to mm
  2027. RawConv => '$val < 40 ? undef : $val', # must be reasonable
  2028. ValueConv => '$val * 25.4 / 1000',
  2029. ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
  2030. PrintConv => 'sprintf("%.2f mm",$val)',
  2031. PrintConvInv => '$val=~s/\s*mm$//;$val',
  2032. },{
  2033. Name => 'FocalPlaneXUnknown',
  2034. Unknown => 1,
  2035. },
  2036. ],
  2037. 3 => [ #4
  2038. {
  2039. Name => 'FocalPlaneYSize',
  2040. Condition => q{
  2041. $$self{Model} !~ /EOS/ or
  2042. $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
  2043. $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
  2044. },
  2045. RawConv => '$val < 40 ? undef : $val', # must be reasonable
  2046. ValueConv => '$val * 25.4 / 1000',
  2047. ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
  2048. PrintConv => 'sprintf("%.2f mm",$val)',
  2049. PrintConvInv => '$val=~s/\s*mm$//;$val',
  2050. },{
  2051. Name => 'FocalPlaneYUnknown',
  2052. Unknown => 1,
  2053. },
  2054. ],
  2055. );
  2056. # Canon shot information (MakerNotes tag 0x04)
  2057. # BinaryData (keys are indices into the int16s array)
  2058. %Image::ExifTool::Canon::ShotInfo = (
  2059. %binaryDataAttrs,
  2060. FORMAT => 'int16s',
  2061. FIRST_ENTRY => 1,
  2062. DATAMEMBER => [ 19 ],
  2063. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  2064. 1 => { #PH
  2065. Name => 'AutoISO',
  2066. Notes => 'actual ISO used = BaseISO * AutoISO / 100',
  2067. ValueConv => 'exp($val/32*log(2))*100',
  2068. ValueConvInv => '32*log($val/100)/log(2)',
  2069. PrintConv => 'sprintf("%.0f",$val)',
  2070. PrintConvInv => '$val',
  2071. },
  2072. 2 => {
  2073. Name => 'BaseISO',
  2074. Priority => 0,
  2075. RawConv => '$val ? $val : undef',
  2076. ValueConv => 'exp($val/32*log(2))*100/32',
  2077. ValueConvInv => '32*log($val*32/100)/log(2)',
  2078. PrintConv => 'sprintf("%.0f",$val)',
  2079. PrintConvInv => '$val',
  2080. },
  2081. 3 => { #9/PH
  2082. Name => 'MeasuredEV',
  2083. Notes => q{
  2084. this is the Canon name for what could better be called MeasuredLV, and
  2085. should be close to the calculated LightValue for a proper exposure with most
  2086. models
  2087. },
  2088. # empirical offset of +5 seems to be good for EOS models, but maybe
  2089. # the offset should be less by up to 1 EV for some PowerShot models
  2090. ValueConv => '$val / 32 + 5',
  2091. ValueConvInv => '($val - 5) * 32',
  2092. PrintConv => 'sprintf("%.2f",$val)',
  2093. PrintConvInv => '$val',
  2094. },
  2095. 4 => { #2, 9
  2096. Name => 'TargetAperture',
  2097. RawConv => '$val > 0 ? $val : undef',
  2098. ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
  2099. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
  2100. PrintConv => 'sprintf("%.2g",$val)',
  2101. PrintConvInv => '$val',
  2102. },
  2103. 5 => { #2
  2104. Name => 'TargetExposureTime',
  2105. # ignore obviously bad values (also, -32768 may be used for n/a)
  2106. # (note that a few models always write 0: DC211, and video models)
  2107. RawConv => '($val > -1000 and ($val or $$self{Model}=~/(EOS|PowerShot|IXUS|IXY)/))? $val : undef',
  2108. ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
  2109. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
  2110. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  2111. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  2112. },
  2113. 6 => {
  2114. Name => 'ExposureCompensation',
  2115. ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
  2116. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
  2117. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  2118. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  2119. },
  2120. 7 => {
  2121. Name => 'WhiteBalance',
  2122. PrintConv => \%canonWhiteBalance,
  2123. SeparateTable => 1,
  2124. },
  2125. 8 => { #PH
  2126. Name => 'SlowShutter',
  2127. PrintConv => {
  2128. -1 => 'n/a',
  2129. 0 => 'Off',
  2130. 1 => 'Night Scene',
  2131. 2 => 'On',
  2132. 3 => 'None',
  2133. },
  2134. },
  2135. 9 => {
  2136. Name => 'SequenceNumber',
  2137. Description => 'Shot Number In Continuous Burst',
  2138. },
  2139. 10 => { #PH/17
  2140. Name => 'OpticalZoomCode',
  2141. Groups => { 2 => 'Camera' },
  2142. Notes => 'for many PowerShot models, a this is 0-6 for wide-tele zoom',
  2143. # (for many models, 0-6 represent 0-100% zoom, but it is always 8 for
  2144. # EOS models, and I have seen values of 16,20,28,32 and 39 too...)
  2145. # - set to 8 for "n/a" by Canon software (ref 22)
  2146. PrintConv => '$val == 8 ? "n/a" : $val',
  2147. PrintConvInv => '$val =~ /[a-z]/i ? 8 : $val',
  2148. },
  2149. # 11 - (8 for all EOS samples, [0,8] for other models - PH)
  2150. 12 => { #37
  2151. Name => 'CameraTemperature',
  2152. Condition => '$$self{Model} =~ /EOS/ and $$self{Model} !~ /EOS-1DS?$/',
  2153. Groups => { 2 => 'Camera' },
  2154. Notes => 'newer EOS models only',
  2155. # usually zero if not valid for an EOS model (exceptions: 1D, 1DS)
  2156. RawConv => '$val ? $val : undef',
  2157. ValueConv => '$val - 128',
  2158. ValueConvInv => '$val + 128',
  2159. PrintConv => '"$val C"',
  2160. PrintConvInv => '$val=~s/ ?C//; $val',
  2161. },
  2162. 13 => { #PH
  2163. Name => 'FlashGuideNumber',
  2164. RawConv => '$val==-1 ? undef : $val',
  2165. ValueConv => '$val / 32',
  2166. ValueConvInv => '$val * 32',
  2167. },
  2168. # AF points for Ixus and IxusV cameras - 02/17/04 M. Rommel (also D30/D60 - PH)
  2169. 14 => { #2
  2170. Name => 'AFPointsInFocus',
  2171. Notes => 'used by D30, D60 and some PowerShot/Ixus models',
  2172. Groups => { 2 => 'Camera' },
  2173. Flags => 'PrintHex',
  2174. RawConv => '$val==0 ? undef : $val',
  2175. PrintConvColumns => 2,
  2176. PrintConv => {
  2177. 0x3000 => 'None (MF)',
  2178. 0x3001 => 'Right',
  2179. 0x3002 => 'Center',
  2180. 0x3003 => 'Center+Right',
  2181. 0x3004 => 'Left',
  2182. 0x3005 => 'Left+Right',
  2183. 0x3006 => 'Left+Center',
  2184. 0x3007 => 'All',
  2185. },
  2186. },
  2187. 15 => {
  2188. Name => 'FlashExposureComp',
  2189. Description => 'Flash Exposure Compensation',
  2190. ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
  2191. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
  2192. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  2193. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  2194. },
  2195. 16 => {
  2196. Name => 'AutoExposureBracketing',
  2197. PrintConv => {
  2198. -1 => 'On',
  2199. 0 => 'Off',
  2200. 1 => 'On (shot 1)',
  2201. 2 => 'On (shot 2)',
  2202. 3 => 'On (shot 3)',
  2203. },
  2204. },
  2205. 17 => {
  2206. Name => 'AEBBracketValue',
  2207. ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
  2208. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
  2209. PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
  2210. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  2211. },
  2212. 18 => { #22
  2213. Name => 'ControlMode',
  2214. PrintConv => {
  2215. 0 => 'n/a',
  2216. 1 => 'Camera Local Control',
  2217. 3 => 'Computer Remote Control',
  2218. },
  2219. },
  2220. 19 => {
  2221. Name => 'FocusDistanceUpper',
  2222. DataMember => 'FocusDistanceUpper',
  2223. Format => 'int16u',
  2224. Notes => 'FocusDistance tags are only extracted if FocusDistanceUpper is non-zero',
  2225. RawConv => '($$self{FocusDistanceUpper} = $val) || undef',
  2226. ValueConv => '$val / 100',
  2227. ValueConvInv => '$val * 100',
  2228. PrintConv => '$val > 655.345 ? "inf" : "$val m"',
  2229. PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
  2230. },
  2231. 20 => {
  2232. Name => 'FocusDistanceLower', # (seems to be the upper distance for the 400D)
  2233. Condition => '$$self{FocusDistanceUpper}',
  2234. Format => 'int16u',
  2235. ValueConv => '$val / 100',
  2236. ValueConvInv => '$val * 100',
  2237. PrintConv => '$val > 655.345 ? "inf" : "$val m"',
  2238. PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
  2239. },
  2240. 21 => {
  2241. Name => 'FNumber',
  2242. Priority => 0,
  2243. RawConv => '$val ? $val : undef',
  2244. # approximate big translation table by simple calculation - PH
  2245. ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
  2246. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
  2247. PrintConv => 'sprintf("%.2g",$val)',
  2248. PrintConvInv => '$val',
  2249. },
  2250. 22 => [
  2251. {
  2252. Name => 'ExposureTime',
  2253. # encoding is different for 20D and 350D (darn!)
  2254. # (but note that encoding is the same for TargetExposureTime - PH)
  2255. Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
  2256. Priority => 0,
  2257. # many models write 0 here in JPEG images (even though 0 is the
  2258. # value for an exposure time of 1 sec), but apparently a value of 0
  2259. # is valid in a CRW image (=1s, D60 sample)
  2260. RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
  2261. # approximate big translation table by simple calculation - PH
  2262. ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))*1000/32',
  2263. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*32/1000)/log(2))',
  2264. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  2265. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  2266. },
  2267. {
  2268. Name => 'ExposureTime',
  2269. Priority => 0,
  2270. # many models write 0 here in JPEG images (even though 0 is the
  2271. # value for an exposure time of 1 sec), but apparently a value of 0
  2272. # is valid in a CRW image (=1s, D60 sample)
  2273. RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
  2274. # approximate big translation table by simple calculation - PH
  2275. ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
  2276. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
  2277. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  2278. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  2279. },
  2280. ],
  2281. 23 => { #37
  2282. Name => 'MeasuredEV2',
  2283. Description => 'Measured EV 2',
  2284. RawConv => '$val ? $val : undef',
  2285. ValueConv => '$val / 8 - 6',
  2286. ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
  2287. },
  2288. 24 => {
  2289. Name => 'BulbDuration',
  2290. ValueConv => '$val / 10',
  2291. ValueConvInv => '$val * 10',
  2292. },
  2293. # 25 - (usually 0, but 1 for 2s timer?, 19 for small AVI, 14 for large
  2294. # AVI, and -6 and -10 for shots 1 and 2 with stitch assist - PH)
  2295. 26 => { #15
  2296. Name => 'CameraType',
  2297. Groups => { 2 => 'Camera' },
  2298. PrintConv => {
  2299. 0 => 'n/a',
  2300. 248 => 'EOS High-end',
  2301. 250 => 'Compact',
  2302. 252 => 'EOS Mid-range',
  2303. 255 => 'DV Camera', #PH
  2304. },
  2305. },
  2306. 27 => {
  2307. Name => 'AutoRotate',
  2308. RawConv => '$val >= 0 ? $val : undef',
  2309. PrintConv => {
  2310. -1 => 'n/a', # (set to -1 when rotated by Canon software)
  2311. 0 => 'None',
  2312. 1 => 'Rotate 90 CW',
  2313. 2 => 'Rotate 180',
  2314. 3 => 'Rotate 270 CW',
  2315. },
  2316. },
  2317. 28 => { #15
  2318. Name => 'NDFilter',
  2319. PrintConv => { -1 => 'n/a', 0 => 'Off', 1 => 'On' },
  2320. },
  2321. 29 => {
  2322. Name => 'SelfTimer2',
  2323. RawConv => '$val >= 0 ? $val : undef',
  2324. ValueConv => '$val / 10',
  2325. ValueConvInv => '$val * 10',
  2326. },
  2327. 33 => { #PH (A570IS)
  2328. Name => 'FlashOutput',
  2329. RawConv => '($$self{Model}=~/(PowerShot|IXUS|IXY)/ or $val) ? $val : undef',
  2330. Notes => q{
  2331. used only for PowerShot models, this has a maximum value of 500 for models
  2332. like the A570IS
  2333. },
  2334. },
  2335. );
  2336. # Canon panorama information (MakerNotes tag 0x05)
  2337. %Image::ExifTool::Canon::Panorama = (
  2338. %binaryDataAttrs,
  2339. FORMAT => 'int16s',
  2340. FIRST_ENTRY => 0,
  2341. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  2342. # 0 - values: always 1
  2343. # 1 - values: 0,256,512(3 sequential L->R images); 0,-256(2 R->L images)
  2344. 2 => 'PanoramaFrameNumber', #(some models this is always 0)
  2345. # 3 - values: 160(SX10IS,A570IS); 871(S30)
  2346. # 4 - values: always 0
  2347. 5 => {
  2348. Name => 'PanoramaDirection',
  2349. PrintConv => {
  2350. 0 => 'Left to Right',
  2351. 1 => 'Right to Left',
  2352. 2 => 'Bottom to Top',
  2353. 3 => 'Top to Bottom',
  2354. 4 => '2x2 Matrix (Clockwise)',
  2355. },
  2356. },
  2357. );
  2358. # D30 color information (MakerNotes tag 0x0a)
  2359. %Image::ExifTool::Canon::UnknownD30 = (
  2360. %binaryDataAttrs,
  2361. FORMAT => 'int16s',
  2362. FIRST_ENTRY => 1,
  2363. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2364. );
  2365. #..............................................................................
  2366. # common CameraInfo tag definitions
  2367. my %ciFNumber = (
  2368. Name => 'FNumber',
  2369. Format => 'int8u',
  2370. Groups => { 2 => 'Image' },
  2371. RawConv => '$val ? $val : undef',
  2372. ValueConv => 'exp(($val-8)/16*log(2))',
  2373. ValueConvInv => 'log($val)*16/log(2)+8',
  2374. PrintConv => 'sprintf("%.2g",$val)',
  2375. PrintConvInv => '$val',
  2376. );
  2377. my %ciExposureTime = (
  2378. Name => 'ExposureTime',
  2379. Format => 'int8u',
  2380. Groups => { 2 => 'Image' },
  2381. RawConv => '$val ? $val : undef',
  2382. ValueConv => 'exp(4*log(2)*(1-Image::ExifTool::Canon::CanonEv($val-24)))',
  2383. ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(1-log($val)/(4*log(2)))+24',
  2384. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  2385. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  2386. );
  2387. my %ciISO = (
  2388. Name => 'ISO',
  2389. Format => 'int8u',
  2390. Groups => { 2 => 'Image' },
  2391. ValueConv => '100*exp(($val/8-9)*log(2))',
  2392. ValueConvInv => '(log($val/100)/log(2)+9)*8',
  2393. PrintConv => 'sprintf("%.0f",$val)',
  2394. PrintConvInv => '$val',
  2395. );
  2396. my %ciCameraTemperature = (
  2397. Name => 'CameraTemperature',
  2398. Format => 'int8u',
  2399. ValueConv => '$val - 128',
  2400. ValueConvInv => '$val + 128',
  2401. PrintConv => '"$val C"',
  2402. PrintConvInv => '$val=~s/ ?C//; $val',
  2403. );
  2404. my %ciMacroMagnification = (
  2405. Name => 'MacroMagnification',
  2406. Notes => 'currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo',
  2407. Condition => '$$self{LensType} and $$self{LensType} == 124',
  2408. # 75=1x, 44=5x, log relationship
  2409. ValueConv => 'exp((75-$val) * log(2) * 3 / 40)',
  2410. ValueConvInv => '$val > 0 ? 75 - log($val) / log(2) * 40 / 3 : undef',
  2411. PrintConv => 'sprintf("%.1fx",$val)',
  2412. PrintConvInv => '$val=~s/\s*x//; $val',
  2413. );
  2414. my %ciFocalLength = (
  2415. Name => 'FocalLength',
  2416. Format => 'int16uRev', # (just to make things confusing, the focal lengths are big-endian)
  2417. # ignore if zero
  2418. RawConv => '$val ? $val : undef',
  2419. PrintConv => '"$val mm"',
  2420. PrintConvInv => '$val=~s/\s*mm//;$val',
  2421. );
  2422. my %ciShortFocal = (
  2423. Name => 'ShortFocal',
  2424. Format => 'int16uRev', # byte order is big-endian
  2425. PrintConv => '"$val mm"',
  2426. PrintConvInv => '$val=~s/\s*mm//;$val',
  2427. );
  2428. my %ciLongFocal = (
  2429. Name => 'LongFocal',
  2430. Format => 'int16uRev', # byte order is big-endian
  2431. PrintConv => '"$val mm"',
  2432. PrintConvInv => '$val=~s/\s*mm//;$val',
  2433. );
  2434. #..............................................................................
  2435. # Camera information for 1D and 1DS (MakerNotes tag 0x0d)
  2436. # (ref 15 unless otherwise noted)
  2437. %Image::ExifTool::Canon::CameraInfo1D = (
  2438. %binaryDataAttrs,
  2439. FORMAT => 'int8u',
  2440. FIRST_ENTRY => 0,
  2441. PRIORITY => 0, # these tags are not reliable since they change with firmware version
  2442. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2443. NOTES => q{
  2444. Information in the "CameraInfo" records is tricky to decode because the
  2445. encodings are very different than in other Canon records (even sometimes
  2446. switching endianness between values within a single camera), plus there is
  2447. considerable variation in format from model to model. The first table below
  2448. lists CameraInfo tags for the 1D and 1DS.
  2449. },
  2450. 0x04 => { %ciExposureTime }, #9
  2451. 0x0a => {
  2452. Name => 'FocalLength',
  2453. Format => 'int16u',
  2454. # ignore if zero
  2455. RawConv => '$val ? $val : undef',
  2456. PrintConv => '"$val mm"',
  2457. PrintConvInv => '$val=~s/\s*mm//;$val',
  2458. },
  2459. 0x0d => { #9
  2460. Name => 'LensType',
  2461. Format => 'int16uRev', # value is little-endian
  2462. SeparateTable => 1,
  2463. RawConv => '$val ? $val : undef', # don't use if value is zero
  2464. ValueConvInv => 'int($val)', # (must truncate decimal part)
  2465. PrintConv => \%canonLensTypes,
  2466. },
  2467. 0x0e => {
  2468. Name => 'ShortFocal',
  2469. Format => 'int16u',
  2470. PrintConv => '"$val mm"',
  2471. PrintConvInv => '$val=~s/\s*mm//;$val',
  2472. },
  2473. 0x10 => {
  2474. Name => 'LongFocal',
  2475. Format => 'int16u',
  2476. PrintConv => '"$val mm"',
  2477. PrintConvInv => '$val=~s/\s*mm//;$val',
  2478. },
  2479. 0x41 => {
  2480. Name => 'SharpnessFrequency', # PatternSharpness?
  2481. Condition => '$$self{Model} =~ /\b1D$/',
  2482. Notes => '1D only',
  2483. PrintConvColumns => 2,
  2484. PrintConv => {
  2485. 0 => 'n/a',
  2486. 1 => 'Lowest',
  2487. 2 => 'Low',
  2488. 3 => 'Standard',
  2489. 4 => 'High',
  2490. 5 => 'Highest',
  2491. },
  2492. },
  2493. 0x42 => {
  2494. Name => 'Sharpness',
  2495. Format => 'int8s',
  2496. Condition => '$$self{Model} =~ /\b1D$/',
  2497. Notes => '1D only',
  2498. },
  2499. 0x44 => {
  2500. Name => 'WhiteBalance',
  2501. Condition => '$$self{Model} =~ /\b1D$/',
  2502. Notes => '1D only',
  2503. SeparateTable => 1,
  2504. PrintConv => \%canonWhiteBalance,
  2505. },
  2506. 0x47 => {
  2507. Name => 'SharpnessFrequency', # PatternSharpness?
  2508. Condition => '$$self{Model} =~ /\b1DS$/',
  2509. Notes => '1DS only',
  2510. PrintConvColumns => 2,
  2511. PrintConv => {
  2512. 0 => 'n/a',
  2513. 1 => 'Lowest',
  2514. 2 => 'Low',
  2515. 3 => 'Standard',
  2516. 4 => 'High',
  2517. 5 => 'Highest',
  2518. },
  2519. },
  2520. 0x48 => [
  2521. {
  2522. Name => 'ColorTemperature',
  2523. Format => 'int16u',
  2524. Condition => '$$self{Model} =~ /\b1D$/',
  2525. Notes => '1D only',
  2526. },
  2527. {
  2528. Name => 'Sharpness',
  2529. Format => 'int8s',
  2530. Condition => '$$self{Model} =~ /\b1DS$/',
  2531. Notes => '1DS only',
  2532. },
  2533. ],
  2534. 0x4a => {
  2535. Name => 'WhiteBalance',
  2536. Condition => '$$self{Model} =~ /\b1DS$/',
  2537. Notes => '1DS only',
  2538. SeparateTable => 1,
  2539. PrintConv => \%canonWhiteBalance,
  2540. },
  2541. 0x4b => {
  2542. Name => 'PictureStyle',
  2543. Condition => '$$self{Model} =~ /\b1D$/',
  2544. Notes => "1D only, called 'Color Matrix' in owner's manual",
  2545. Flags => ['PrintHex','SeparateTable'],
  2546. PrintConv => \%pictureStyles,
  2547. },
  2548. 0x4e => {
  2549. Name => 'ColorTemperature',
  2550. Format => 'int16u',
  2551. Condition => '$$self{Model} =~ /\b1DS$/',
  2552. Notes => '1DS only',
  2553. },
  2554. 0x51 => {
  2555. Name => 'PictureStyle',
  2556. Condition => '$$self{Model} =~ /\b1DS$/',
  2557. Notes => '1DS only',
  2558. Flags => ['PrintHex','SeparateTable'],
  2559. PrintConv => \%pictureStyles,
  2560. },
  2561. );
  2562. # Camera information for 1DmkII and 1DSmkII (MakerNotes tag 0x0d)
  2563. # (ref 15 unless otherwise noted)
  2564. %Image::ExifTool::Canon::CameraInfo1DmkII = (
  2565. %binaryDataAttrs,
  2566. FORMAT => 'int8u',
  2567. FIRST_ENTRY => 0,
  2568. PRIORITY => 0,
  2569. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2570. NOTES => 'CameraInfo tags for the 1DmkII and 1DSmkII.',
  2571. 0x04 => { %ciExposureTime }, #9
  2572. 0x09 => { %ciFocalLength }, #9
  2573. 0x0c => { #9
  2574. Name => 'LensType',
  2575. Format => 'int16uRev', # value is big-endian
  2576. SeparateTable => 1,
  2577. RawConv => '$val ? $val : undef', # don't use if value is zero
  2578. ValueConvInv => 'int($val)', # (must truncate decimal part)
  2579. PrintConv => \%canonLensTypes,
  2580. },
  2581. 0x11 => { %ciShortFocal }, #9
  2582. 0x13 => { %ciLongFocal }, #9
  2583. 0x2d => { #9
  2584. Name => 'FocalType',
  2585. PrintConv => {
  2586. 0 => 'Fixed',
  2587. 2 => 'Zoom',
  2588. },
  2589. },
  2590. 0x36 => {
  2591. Name => 'WhiteBalance',
  2592. SeparateTable => 1,
  2593. PrintConv => \%canonWhiteBalance,
  2594. },
  2595. 0x37 => {
  2596. Name => 'ColorTemperature',
  2597. Format => 'int16uRev',
  2598. },
  2599. 0x39 => {
  2600. Name => 'CanonImageSize',
  2601. Format => 'int16u',
  2602. PrintConvColumns => 2,
  2603. PrintConv => \%canonImageSize,
  2604. },
  2605. 0x66 => {
  2606. Name => 'JPEGQuality',
  2607. Notes => 'a number from 1 to 10',
  2608. },
  2609. 0x6c => { #12
  2610. Name => 'PictureStyle',
  2611. Flags => ['PrintHex','SeparateTable'],
  2612. PrintConv => \%pictureStyles,
  2613. },
  2614. 0x6e => {
  2615. Name => 'Saturation',
  2616. Format => 'int8s',
  2617. %Image::ExifTool::Exif::printParameter,
  2618. },
  2619. 0x6f => {
  2620. Name => 'ColorTone',
  2621. Format => 'int8s',
  2622. %Image::ExifTool::Exif::printParameter,
  2623. },
  2624. 0x72 => {
  2625. Name => 'Sharpness',
  2626. Format => 'int8s',
  2627. },
  2628. 0x73 => {
  2629. Name => 'Contrast',
  2630. Format => 'int8s',
  2631. %Image::ExifTool::Exif::printParameter,
  2632. },
  2633. 0x75 => {
  2634. Name => 'ISO',
  2635. Format => 'string[5]',
  2636. },
  2637. );
  2638. # Camera information for the 1DmkIIN (MakerNotes tag 0x0d)
  2639. # (ref 9 unless otherwise noted)
  2640. %Image::ExifTool::Canon::CameraInfo1DmkIIN = (
  2641. %binaryDataAttrs,
  2642. FORMAT => 'int8u',
  2643. FIRST_ENTRY => 0,
  2644. PRIORITY => 0,
  2645. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2646. NOTES => 'CameraInfo tags for the 1DmkIIN.',
  2647. 0x04 => { %ciExposureTime },
  2648. 0x09 => { %ciFocalLength },
  2649. 0x0c => {
  2650. Name => 'LensType',
  2651. Format => 'int16uRev', # value is big-endian
  2652. SeparateTable => 1,
  2653. RawConv => '$val ? $val : undef', # don't use if value is zero
  2654. ValueConvInv => 'int($val)', # (must truncate decimal part)
  2655. PrintConv => \%canonLensTypes,
  2656. },
  2657. 0x11 => { %ciShortFocal },
  2658. 0x13 => { %ciLongFocal },
  2659. 0x36 => { #15
  2660. Name => 'WhiteBalance',
  2661. SeparateTable => 1,
  2662. PrintConv => \%canonWhiteBalance,
  2663. },
  2664. 0x37 => { #15
  2665. Name => 'ColorTemperature',
  2666. Format => 'int16uRev',
  2667. },
  2668. 0x73 => { #15
  2669. Name => 'PictureStyle',
  2670. Flags => ['PrintHex','SeparateTable'],
  2671. PrintConv => \%pictureStyles,
  2672. },
  2673. 0x74 => { #15
  2674. Name => 'Sharpness',
  2675. Format => 'int8s',
  2676. },
  2677. 0x75 => { #15
  2678. Name => 'Contrast',
  2679. Format => 'int8s',
  2680. %Image::ExifTool::Exif::printParameter,
  2681. },
  2682. 0x76 => { #15
  2683. Name => 'Saturation',
  2684. Format => 'int8s',
  2685. %Image::ExifTool::Exif::printParameter,
  2686. },
  2687. 0x77 => { #15
  2688. Name => 'ColorTone',
  2689. Format => 'int8s',
  2690. %Image::ExifTool::Exif::printParameter,
  2691. },
  2692. 0x79 => { #15
  2693. Name => 'ISO',
  2694. Format => 'string[5]',
  2695. },
  2696. );
  2697. # Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d)
  2698. # (ref PH unless otherwise noted)
  2699. %Image::ExifTool::Canon::CameraInfo1DmkIII = (
  2700. %binaryDataAttrs,
  2701. FORMAT => 'int8u',
  2702. FIRST_ENTRY => 0,
  2703. PRIORITY => 0,
  2704. IS_SUBDIR => [ 0x2aa ],
  2705. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2706. NOTES => 'CameraInfo tags for the 1DmkIII and 1DSmkIII.',
  2707. 0x03 => { %ciFNumber },
  2708. 0x04 => { %ciExposureTime }, #9
  2709. 0x06 => { %ciISO },
  2710. 0x18 => { %ciCameraTemperature }, #36
  2711. 0x1b => { %ciMacroMagnification }, #(NC)
  2712. 0x1d => { %ciFocalLength },
  2713. 0x30 => {
  2714. Name => 'CameraOrientation', # <-- (always 9th byte after 0xbbbb for all models - Dave Coffin)
  2715. PrintConv => {
  2716. 0 => 'Horizontal (normal)',
  2717. 1 => 'Rotate 90 CW',
  2718. 2 => 'Rotate 270 CW',
  2719. },
  2720. },
  2721. 0x43 => { #21/24
  2722. Name => 'FocusDistanceUpper',
  2723. # (it looks like the focus distances are also odd-byte big-endian)
  2724. %focusDistanceByteSwap,
  2725. },
  2726. 0x45 => { #21/24
  2727. Name => 'FocusDistanceLower',
  2728. %focusDistanceByteSwap,
  2729. },
  2730. 0x5e => { #15
  2731. Name => 'WhiteBalance',
  2732. Format => 'int16u',
  2733. PrintConv => \%canonWhiteBalance,
  2734. SeparateTable => 1,
  2735. },
  2736. 0x62 => { #15
  2737. Name => 'ColorTemperature',
  2738. Format => 'int16u',
  2739. },
  2740. 0x86 => {
  2741. Name => 'PictureStyle',
  2742. Flags => ['PrintHex','SeparateTable'],
  2743. PrintConv => \%pictureStyles,
  2744. },
  2745. 0x111 => { #15
  2746. Name => 'LensType',
  2747. Format => 'int16uRev', # value is big-endian
  2748. SeparateTable => 1,
  2749. ValueConvInv => 'int($val)', # (must truncate decimal part)
  2750. PrintConv => \%canonLensTypes,
  2751. },
  2752. 0x113 => { %ciShortFocal },
  2753. 0x115 => { %ciLongFocal },
  2754. 0x136 => { #15
  2755. Name => 'FirmwareVersion',
  2756. Format => 'string[6]',
  2757. },
  2758. 0x172 => {
  2759. Name => 'FileIndex',
  2760. Groups => { 2 => 'Image' },
  2761. Format => 'int32u',
  2762. ValueConv => '$val + 1',
  2763. ValueConvInv => '$val - 1',
  2764. },
  2765. 0x176 => {
  2766. Name => 'ShutterCount',
  2767. Notes => 'may be valid only for some 1DmkIII copies, even running the same firmware',
  2768. Format => 'int32u',
  2769. ValueConv => '$val + 1',
  2770. ValueConvInv => '$val - 1',
  2771. },
  2772. 0x17e => { #(NC)
  2773. Name => 'DirectoryIndex',
  2774. Groups => { 2 => 'Image' },
  2775. Format => 'int32u',
  2776. ValueConv => '$val - 1',
  2777. ValueConvInv => '$val + 1',
  2778. },
  2779. 0x2aa => { #48
  2780. Name => 'PictureStyleInfo',
  2781. SubDirectory => {
  2782. TagTable => 'Image::ExifTool::Canon::PSInfo',
  2783. },
  2784. },
  2785. 0x45a => { #29
  2786. Name => 'TimeStamp1',
  2787. Condition => '$$self{Model} =~ /\b1D Mark III$/',
  2788. Format => 'int32u',
  2789. Groups => { 2 => 'Time' },
  2790. # observed in 1DmkIII firmware 5.3.1 (pre-production), 1.0.3, 1.0.8
  2791. Notes => 'only valid for some versions of the 1DmkIII firmware',
  2792. Shift => 'Time',
  2793. RawConv => '$val ? $val : undef',
  2794. ValueConv => 'ConvertUnixTime($val)',
  2795. ValueConvInv => 'GetUnixTime($val)',
  2796. PrintConv => '$self->ConvertDateTime($val)',
  2797. PrintConvInv => '$self->InverseDateTime($val)',
  2798. },
  2799. 0x45e => {
  2800. Name => 'TimeStamp',
  2801. Format => 'int32u',
  2802. Groups => { 2 => 'Time' },
  2803. # observed in 1DmkIII firmware 1.1.0, 1.1.3 and
  2804. # 1DSmkIII firmware 1.0.0, 1.0.4, 2.1.2, 2.7.1
  2805. Notes => 'valid for the 1DSmkIII and some versions of the 1DmkIII firmware',
  2806. Shift => 'Time',
  2807. RawConv => '$val ? $val : undef',
  2808. ValueConv => 'ConvertUnixTime($val)',
  2809. ValueConvInv => 'GetUnixTime($val)',
  2810. PrintConv => '$self->ConvertDateTime($val)',
  2811. PrintConvInv => '$self->InverseDateTime($val)',
  2812. },
  2813. );
  2814. # Canon camera information for 1DmkIV (MakerNotes tag 0x0d) (ref PH)
  2815. %Image::ExifTool::Canon::CameraInfo1DmkIV = (
  2816. %binaryDataAttrs,
  2817. FIRST_ENTRY => 0,
  2818. PRIORITY => 0,
  2819. DATAMEMBER => [ 0x57 ],
  2820. IS_SUBDIR => [ 0x363, 0x368 ],
  2821. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  2822. NOTES => 'CameraInfo tags for the 1DmkIV.',
  2823. 0x03 => { %ciFNumber },
  2824. 0x04 => { %ciExposureTime },
  2825. 0x06 => { %ciISO },
  2826. 0x07 => {
  2827. Name => 'HighlightTonePriority',
  2828. PrintConv => { 0 => 'Off', 1 => 'On' },
  2829. },
  2830. 0x08 => {
  2831. Name => 'MeasuredEV2',
  2832. Description => 'Measured EV 2',
  2833. RawConv => '$val ? $val : undef',
  2834. ValueConv => '$val / 8 - 6',
  2835. ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
  2836. },
  2837. 0x09 => {
  2838. Name => 'MeasuredEV3',
  2839. Description => 'Measured EV 3',
  2840. RawConv => '$val ? $val : undef',
  2841. ValueConv => '$val / 8 - 6',
  2842. ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
  2843. },
  2844. 0x15 => {
  2845. Name => 'FlashMeteringMode',
  2846. PrintConv => {
  2847. 0 => 'E-TTL',
  2848. 3 => 'TTL',
  2849. 4 => 'External Auto',
  2850. 5 => 'External Manual',
  2851. 6 => 'Off',
  2852. },
  2853. },
  2854. 0x19 => { %ciCameraTemperature },
  2855. 0x1e => { %ciFocalLength },
  2856. 0x35 => {
  2857. Name => 'CameraOrientation',
  2858. PrintConv => {
  2859. 0 => 'Horizontal (normal)',
  2860. 1 => 'Rotate 90 CW',
  2861. 2 => 'Rotate 270 CW',
  2862. },
  2863. },
  2864. 0x54 => {
  2865. Name => 'FocusDistanceUpper',
  2866. %focusDistanceByteSwap,
  2867. },
  2868. 0x56 => {
  2869. Name => 'FocusDistanceLower',
  2870. %focusDistanceByteSwap,
  2871. },
  2872. 0x57 => {
  2873. Name => 'FirmwareVersionLookAhead',
  2874. Hidden => 1,
  2875. # must look ahead to check location of FirmwareVersion string
  2876. Format => 'undef[0x1a6]',
  2877. RawConv => q{
  2878. my $t = substr($val, 0x1e8 - 0x57, 6);
  2879. $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmA} = 1;
  2880. $t = substr($val, 0x1ed - 0x57, 6);
  2881. $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmB} = 1;
  2882. return undef; # not a real tag
  2883. },
  2884. },
  2885. 0x77 => {
  2886. Name => 'WhiteBalance',
  2887. Condition => '$$self{CanonFirmA}',
  2888. Notes => 'firmware 4.2.1',
  2889. Format => 'int16u',
  2890. SeparateTable => 1,
  2891. PrintConv => \%canonWhiteBalance,
  2892. },
  2893. 0x78 => {
  2894. Name => 'WhiteBalance',
  2895. Condition => '$$self{CanonFirmB}',
  2896. Notes => 'firmware 1.0.4',
  2897. Format => 'int16u',
  2898. SeparateTable => 1,
  2899. PrintConv => \%canonWhiteBalance,
  2900. },
  2901. 0x7b => {
  2902. Name => 'ColorTemperature',
  2903. Condition => '$$self{CanonFirmA}',
  2904. Format => 'int16u',
  2905. },
  2906. 0x7c => {
  2907. Name => 'ColorTemperature',
  2908. Condition => '$$self{CanonFirmB}',
  2909. Format => 'int16u',
  2910. },
  2911. 0x14e => {
  2912. Name => 'LensType',
  2913. Condition => '$$self{CanonFirmA}',
  2914. Format => 'int16uRev', # value is big-endian
  2915. SeparateTable => 1,
  2916. ValueConvInv => 'int($val)', # (must truncate decimal part)
  2917. PrintConv => \%canonLensTypes,
  2918. },
  2919. 0x14f => {
  2920. Name => 'LensType',
  2921. Condition => '$$self{CanonFirmB}',
  2922. Format => 'int16uRev', # value is big-endian
  2923. SeparateTable => 1,
  2924. ValueConvInv => 'int($val)', # (must truncate decimal part)
  2925. PrintConv => \%canonLensTypes,
  2926. },
  2927. 0x150 => {
  2928. %ciShortFocal,
  2929. Condition => '$$self{CanonFirmA}',
  2930. },
  2931. 0x151 => {
  2932. %ciShortFocal,
  2933. Condition => '$$self{CanonFirmB}',
  2934. },
  2935. 0x152 => {
  2936. %ciLongFocal,
  2937. Condition => '$$self{CanonFirmA}',
  2938. },
  2939. 0x153 => {
  2940. %ciLongFocal,
  2941. Condition => '$$self{CanonFirmB}',
  2942. },
  2943. 0x1e8 => { # firmware 4.2.1 (pre-production)
  2944. Name => 'FirmwareVersion',
  2945. Condition => '$$self{CanonFirmA}',
  2946. Format => 'string[6]',
  2947. Writable => 0,
  2948. },
  2949. 0x1ed => { # firmware 1.0.4
  2950. Name => 'FirmwareVersion',
  2951. Condition => '$$self{CanonFirmB}',
  2952. Format => 'string[6]',
  2953. Writable => 0,
  2954. },
  2955. 0x227 => { #(NC)
  2956. Name => 'FileIndex',
  2957. Condition => '$$self{CanonFirmA}',
  2958. Groups => { 2 => 'Image' },
  2959. Format => 'int32u',
  2960. ValueConv => '$val + 1',
  2961. ValueConvInv => '$val - 1',
  2962. },
  2963. 0x22c => { #(NC)
  2964. Name => 'FileIndex',
  2965. Condition => '$$self{CanonFirmB}',
  2966. Groups => { 2 => 'Image' },
  2967. Format => 'int32u',
  2968. ValueConv => '$val + 1',
  2969. ValueConvInv => '$val - 1',
  2970. },
  2971. 0x233 => { #(NC)
  2972. Name => 'DirectoryIndex',
  2973. Condition => '$$self{CanonFirmA}',
  2974. Groups => { 2 => 'Image' },
  2975. Format => 'int32u',
  2976. ValueConv => '$val - 1',
  2977. ValueConvInv => '$val + 1',
  2978. },
  2979. 0x238 => { #(NC)
  2980. Name => 'DirectoryIndex',
  2981. Condition => '$$self{CanonFirmB}',
  2982. Groups => { 2 => 'Image' },
  2983. Format => 'int32u',
  2984. ValueConv => '$val - 1',
  2985. ValueConvInv => '$val + 1',
  2986. },
  2987. 0x363 => {
  2988. Name => 'PictureStyleInfo',
  2989. Condition => '$$self{CanonFirmA}',
  2990. SubDirectory => {
  2991. TagTable => 'Image::ExifTool::Canon::PSInfo',
  2992. },
  2993. },
  2994. 0x368 => {
  2995. Name => 'PictureStyleInfo',
  2996. Condition => '$$self{CanonFirmB}',
  2997. SubDirectory => {
  2998. TagTable => 'Image::ExifTool::Canon::PSInfo',
  2999. },
  3000. },
  3001. );
  3002. # Camera information for 5D (MakerNotes tag 0x0d)
  3003. # (ref 12 unless otherwise noted)
  3004. %Image::ExifTool::Canon::CameraInfo5D = (
  3005. %binaryDataAttrs,
  3006. FORMAT => 'int8s',
  3007. FIRST_ENTRY => 0,
  3008. PRIORITY => 0,
  3009. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3010. NOTES => 'CameraInfo tags for the EOS 5D.',
  3011. 0x03 => { %ciFNumber }, #PH
  3012. 0x04 => { %ciExposureTime }, #9
  3013. 0x06 => { %ciISO }, #PH
  3014. 0x0c => { #9
  3015. Name => 'LensType',
  3016. Format => 'int16uRev', # value is big-endian
  3017. SeparateTable => 1,
  3018. RawConv => '$val ? $val : undef', # don't use if value is zero
  3019. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3020. PrintConv => \%canonLensTypes,
  3021. },
  3022. 0x17 => { %ciCameraTemperature }, #PH
  3023. 0x1b => { %ciMacroMagnification }, #PH
  3024. 0x27 => { #PH
  3025. Name => 'CameraOrientation',
  3026. PrintConv => {
  3027. 0 => 'Horizontal (normal)',
  3028. 1 => 'Rotate 90 CW',
  3029. 2 => 'Rotate 270 CW',
  3030. },
  3031. },
  3032. 0x28 => { %ciFocalLength }, #15
  3033. 0x38 => {
  3034. Name => 'AFPointsInFocus5D',
  3035. Format => 'int16uRev',
  3036. PrintConvColumns => 2,
  3037. PrintConv => { BITMASK => {
  3038. 0 => 'Center',
  3039. 1 => 'Top',
  3040. 2 => 'Bottom',
  3041. 3 => 'Upper-left',
  3042. 4 => 'Upper-right',
  3043. 5 => 'Lower-left',
  3044. 6 => 'Lower-right',
  3045. 7 => 'Left',
  3046. 8 => 'Right',
  3047. 9 => 'AI Servo1',
  3048. 10 => 'AI Servo2',
  3049. 11 => 'AI Servo3',
  3050. 12 => 'AI Servo4',
  3051. 13 => 'AI Servo5',
  3052. 14 => 'AI Servo6',
  3053. } },
  3054. },
  3055. 0x54 => { #15
  3056. Name => 'WhiteBalance',
  3057. Format => 'int16u',
  3058. SeparateTable => 1,
  3059. PrintConv => \%canonWhiteBalance,
  3060. },
  3061. 0x58 => { #15
  3062. Name => 'ColorTemperature',
  3063. Format => 'int16u',
  3064. },
  3065. 0x6c => {
  3066. Name => 'PictureStyle',
  3067. Format => 'int8u',
  3068. Flags => ['PrintHex','SeparateTable'],
  3069. PrintConv => \%pictureStyles,
  3070. },
  3071. 0x93 => { %ciShortFocal }, #15
  3072. 0x95 => { %ciLongFocal }, #15
  3073. 0x97 => { #15
  3074. Name => 'LensType',
  3075. Format => 'int16uRev', # value is big-endian
  3076. SeparateTable => 1,
  3077. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3078. PrintConv => \%canonLensTypes,
  3079. },
  3080. 0xa4 => { #PH
  3081. Name => 'FirmwareRevision',
  3082. Format => 'string[8]',
  3083. },
  3084. 0xac => { #PH
  3085. Name => 'ShortOwnerName',
  3086. Format => 'string[16]',
  3087. },
  3088. 0xcc => { #PH (NC)
  3089. Name => 'DirectoryIndex',
  3090. Groups => { 2 => 'Image' },
  3091. Format => 'int32u',
  3092. },
  3093. 0xd0 => {
  3094. Name => 'FileIndex',
  3095. Format => 'int16u',
  3096. Groups => { 2 => 'Image' },
  3097. ValueConv => '$val + 1',
  3098. ValueConvInv => '$val - 1',
  3099. },
  3100. 0xe8 => 'ContrastStandard',
  3101. 0xe9 => 'ContrastPortrait',
  3102. 0xea => 'ContrastLandscape',
  3103. 0xeb => 'ContrastNeutral',
  3104. 0xec => 'ContrastFaithful',
  3105. 0xed => 'ContrastMonochrome',
  3106. 0xee => 'ContrastUserDef1',
  3107. 0xef => 'ContrastUserDef2',
  3108. 0xf0 => 'ContrastUserDef3',
  3109. # sharpness values are 0-7
  3110. 0xf1 => 'SharpnessStandard',
  3111. 0xf2 => 'SharpnessPortrait',
  3112. 0xf3 => 'SharpnessLandscape',
  3113. 0xf4 => 'SharpnessNeutral',
  3114. 0xf5 => 'SharpnessFaithful',
  3115. 0xf6 => 'SharpnessMonochrome',
  3116. 0xf7 => 'SharpnessUserDef1',
  3117. 0xf8 => 'SharpnessUserDef2',
  3118. 0xf9 => 'SharpnessUserDef3',
  3119. 0xfa => 'SaturationStandard',
  3120. 0xfb => 'SaturationPortrait',
  3121. 0xfc => 'SaturationLandscape',
  3122. 0xfd => 'SaturationNeutral',
  3123. 0xfe => 'SaturationFaithful',
  3124. 0xff => {
  3125. Name => 'FilterEffectMonochrome',
  3126. PrintConv => {
  3127. 0 => 'None',
  3128. 1 => 'Yellow',
  3129. 2 => 'Orange',
  3130. 3 => 'Red',
  3131. 4 => 'Green',
  3132. -559038737 => 'n/a', # (0xdeadbeef)
  3133. },
  3134. },
  3135. 0x100 => 'SaturationUserDef1',
  3136. 0x101 => 'SaturationUserDef2',
  3137. 0x102 => 'SaturationUserDef3',
  3138. 0x103 => 'ColorToneStandard',
  3139. 0x104 => 'ColorTonePortrait',
  3140. 0x105 => 'ColorToneLandscape',
  3141. 0x106 => 'ColorToneNeutral',
  3142. 0x107 => 'ColorToneFaithful',
  3143. 0x108 => {
  3144. Name => 'ToningEffectMonochrome',
  3145. PrintConv => {
  3146. 0 => 'None',
  3147. 1 => 'Sepia',
  3148. 2 => 'Blue',
  3149. 3 => 'Purple',
  3150. 4 => 'Green',
  3151. -559038737 => 'n/a', # (0xdeadbeef)
  3152. },
  3153. },
  3154. 0x109 => 'ColorToneUserDef1',
  3155. 0x10a => 'ColorToneUserDef2',
  3156. 0x10b => 'ColorToneUserDef3',
  3157. 0x10c => {
  3158. Name => 'UserDef1PictureStyle',
  3159. Format => 'int16u',
  3160. PrintHex => 1, # (only needed for one tag)
  3161. SeparateTable => 'UserDefStyle',
  3162. PrintConv => \%userDefStyles,
  3163. },
  3164. 0x10e => {
  3165. Name => 'UserDef2PictureStyle',
  3166. Format => 'int16u',
  3167. SeparateTable => 'UserDefStyle',
  3168. PrintConv => \%userDefStyles,
  3169. },
  3170. 0x110 => {
  3171. Name => 'UserDef3PictureStyle',
  3172. Format => 'int16u',
  3173. SeparateTable => 'UserDefStyle',
  3174. PrintConv => \%userDefStyles,
  3175. },
  3176. 0x11c => {
  3177. Name => 'TimeStamp',
  3178. Format => 'int32u',
  3179. Groups => { 2 => 'Time' },
  3180. Shift => 'Time',
  3181. RawConv => '$val ? $val : undef',
  3182. ValueConv => 'ConvertUnixTime($val)',
  3183. ValueConvInv => 'GetUnixTime($val)',
  3184. PrintConv => '$self->ConvertDateTime($val)',
  3185. PrintConvInv => '$self->InverseDateTime($val)',
  3186. },
  3187. );
  3188. # Camera information for 5D Mark II (MakerNotes tag 0x0d)
  3189. # (ref PH unless otherwise noted)
  3190. %Image::ExifTool::Canon::CameraInfo5DmkII = (
  3191. %binaryDataAttrs,
  3192. FORMAT => 'int8u',
  3193. FIRST_ENTRY => 0,
  3194. PRIORITY => 0,
  3195. IS_SUBDIR => [ 0x15a, 0x17e ],
  3196. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3197. NOTES => 'CameraInfo tags for the EOS 5D Mark II.',
  3198. 0x03 => { %ciFNumber },
  3199. 0x04 => { %ciExposureTime },
  3200. 0x06 => { %ciISO },
  3201. 0x07 => {
  3202. Name => 'HighlightTonePriority',
  3203. PrintConv => { 0 => 'Off', 1 => 'On' },
  3204. },
  3205. 0x1b => { %ciMacroMagnification }, #PH
  3206. 0x15 => { #PH (580 EX II)
  3207. Name => 'FlashMeteringMode',
  3208. PrintConv => {
  3209. 0 => 'E-TTL',
  3210. 3 => 'TTL',
  3211. 4 => 'External Auto',
  3212. 5 => 'External Manual',
  3213. 6 => 'Off',
  3214. },
  3215. },
  3216. 0x19 => { %ciCameraTemperature }, #36
  3217. # 0x1b, 0x1c, 0x1d - same as FileInfo 0x10 - PH
  3218. 0x1e => { %ciFocalLength },
  3219. 0x31 => {
  3220. Name => 'CameraOrientation',
  3221. PrintConv => {
  3222. 0 => 'Horizontal (normal)',
  3223. 1 => 'Rotate 90 CW',
  3224. 2 => 'Rotate 270 CW',
  3225. },
  3226. },
  3227. 0x50 => {
  3228. Name => 'FocusDistanceUpper',
  3229. %focusDistanceByteSwap,
  3230. },
  3231. 0x52 => {
  3232. Name => 'FocusDistanceLower',
  3233. %focusDistanceByteSwap,
  3234. },
  3235. 0x6f => {
  3236. Name => 'WhiteBalance',
  3237. Format => 'int16u',
  3238. SeparateTable => 1,
  3239. PrintConv => \%canonWhiteBalance,
  3240. },
  3241. 0x73 => {
  3242. Name => 'ColorTemperature',
  3243. Format => 'int16u',
  3244. },
  3245. 0xa7 => {
  3246. Name => 'PictureStyle',
  3247. Format => 'int8u',
  3248. Flags => ['PrintHex','SeparateTable'],
  3249. PrintConv => \%pictureStyles,
  3250. },
  3251. 0xbd => {
  3252. Name => 'HighISONoiseReduction',
  3253. PrintConv => {
  3254. 0 => 'Standard',
  3255. 1 => 'Low',
  3256. 2 => 'Strong',
  3257. 3 => 'Off',
  3258. },
  3259. },
  3260. 0xbf => {
  3261. Name => 'AutoLightingOptimizer',
  3262. PrintConv => {
  3263. 0 => 'Standard',
  3264. 1 => 'Low',
  3265. 2 => 'Strong',
  3266. 3 => 'Off',
  3267. },
  3268. },
  3269. 0xe6 => {
  3270. Name => 'LensType',
  3271. Format => 'int16uRev', # value is big-endian
  3272. SeparateTable => 1,
  3273. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3274. PrintConv => \%canonLensTypes,
  3275. },
  3276. 0xe8 => { %ciShortFocal },
  3277. 0xea => { %ciLongFocal },
  3278. 0x15a => {
  3279. Name => 'CameraInfo5DmkII_2a',
  3280. Condition => '$$valPt =~ /^\d+\.\d+\.\d+[\s\0]/',
  3281. Notes => 'at this location for firmware 3.4.6 and 3.6.1',
  3282. SubDirectory => {
  3283. TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII_2',
  3284. },
  3285. },
  3286. 0x17e => {
  3287. Name => 'CameraInfo5DmkII_2b',
  3288. Condition => '$$valPt =~ /^\d+\.\d+\.\d+[\s\0]/',
  3289. Notes => 'at this location for firmware 1.0.6 and 4.1.1',
  3290. SubDirectory => {
  3291. TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII_2',
  3292. },
  3293. },
  3294. );
  3295. # variable-position Camera information for 5DmkII (ref PH)
  3296. %Image::ExifTool::Canon::CameraInfo5DmkII_2 = (
  3297. %binaryDataAttrs,
  3298. FIRST_ENTRY => 0,
  3299. PRIORITY => 0,
  3300. IS_SUBDIR => [ 0x179 ],
  3301. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3302. NOTES => 'More CameraInfo tags for the EOS 5D Mark II.',
  3303. 0 => {
  3304. Name => 'FirmwareVersion',
  3305. Format => 'string[6]',
  3306. Writable => 0, # not writable for logic reasons
  3307. # some firmwares have a null instead of a space after the version number
  3308. RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
  3309. },
  3310. 0x3d => {
  3311. Name => 'FileIndex',
  3312. Groups => { 2 => 'Image' },
  3313. Format => 'int32u',
  3314. ValueConv => '$val + 1',
  3315. ValueConvInv => '$val - 1',
  3316. },
  3317. 0x49 => { #(NC)
  3318. Name => 'DirectoryIndex',
  3319. Groups => { 2 => 'Image' },
  3320. Format => 'int32u',
  3321. ValueConv => '$val - 1',
  3322. ValueConvInv => '$val + 1',
  3323. },
  3324. 0x179 => { #48
  3325. Name => 'PictureStyleInfo',
  3326. SubDirectory => {
  3327. TagTable => 'Image::ExifTool::Canon::PSInfo',
  3328. },
  3329. },
  3330. );
  3331. # Camera information for 7D (MakerNotes tag 0x0d) (ref PH)
  3332. %Image::ExifTool::Canon::CameraInfo7D = (
  3333. %binaryDataAttrs,
  3334. FORMAT => 'int8u',
  3335. FIRST_ENTRY => 0,
  3336. PRIORITY => 0,
  3337. IS_SUBDIR => [ 0x20, 0x24 ],
  3338. DATAMEMBER => [ 0x1f ],
  3339. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3340. NOTES => 'CameraInfo tags for the EOS 7D.',
  3341. 0x03 => { %ciFNumber },
  3342. 0x04 => { %ciExposureTime },
  3343. 0x06 => { %ciISO },
  3344. 0x07 => {
  3345. Name => 'HighlightTonePriority',
  3346. PrintConv => { 0 => 'Off', 1 => 'On' },
  3347. },
  3348. 0x08 => { #37
  3349. Name => 'MeasuredEV2',
  3350. Description => 'Measured EV 2',
  3351. RawConv => '$val ? $val : undef',
  3352. ValueConv => '$val / 8 - 6',
  3353. ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
  3354. },
  3355. 0x09 => { #37
  3356. Name => 'MeasuredEV',
  3357. Description => 'Measured EV',
  3358. RawConv => '$val ? $val : undef',
  3359. ValueConv => '$val / 8 - 6',
  3360. ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
  3361. },
  3362. 0x15 => { #PH (580 EX II)
  3363. Name => 'FlashMeteringMode',
  3364. PrintConv => {
  3365. 0 => 'E-TTL',
  3366. 3 => 'TTL',
  3367. 4 => 'External Auto',
  3368. 5 => 'External Manual',
  3369. 6 => 'Off',
  3370. },
  3371. },
  3372. 0x19 => { %ciCameraTemperature },
  3373. 0x1e => { %ciFocalLength },
  3374. 0x1f => {
  3375. Name => 'FirmwareVersionLookAhead',
  3376. Hidden => 1,
  3377. # must look ahead to check location of FirmwareVersion string
  3378. Format => 'undef[0x1a0]',
  3379. RawConv => q{
  3380. my $t = substr($val, 0x1a8 - 0x1f, 6);
  3381. $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmA} = 1;
  3382. $t = substr($val, 0x1ac - 0x1f, 6);
  3383. $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmB} = 1;
  3384. return undef; # not a real tag
  3385. },
  3386. },
  3387. 0x20 => {
  3388. Name => 'CameraInfo7D_2a',
  3389. Condition => '$$self{CanonFirmA}',
  3390. Notes => 'at this location for pre-production firmware version 3.7.5',
  3391. SubDirectory => {
  3392. TagTable => 'Image::ExifTool::Canon::CameraInfo7D_2',
  3393. },
  3394. },
  3395. 0x24 => {
  3396. Name => 'CameraInfo7D_2b',
  3397. Condition => '$$self{CanonFirmB}',
  3398. Notes => 'at this location for firmware 1.0.7, 1.0.8, 1.1.0, 1.2.1 and 1.2.2',
  3399. SubDirectory => {
  3400. TagTable => 'Image::ExifTool::Canon::CameraInfo7D_2',
  3401. },
  3402. },
  3403. );
  3404. # variable-position Camera information for 7D (ref PH)
  3405. %Image::ExifTool::Canon::CameraInfo7D_2 = (
  3406. %binaryDataAttrs,
  3407. FORMAT => 'int8u',
  3408. FIRST_ENTRY => 0,
  3409. PRIORITY => 0,
  3410. IS_SUBDIR => [ 0x303 ],
  3411. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3412. NOTES => 'More CameraInfo tags for the EOS 7D.',
  3413. 0x11 => {
  3414. Name => 'CameraOrientation',
  3415. PrintConv => {
  3416. 0 => 'Horizontal (normal)',
  3417. 1 => 'Rotate 90 CW',
  3418. 2 => 'Rotate 270 CW',
  3419. },
  3420. },
  3421. 0x30 => {
  3422. Name => 'FocusDistanceUpper',
  3423. %focusDistanceByteSwap,
  3424. },
  3425. 0x32 => {
  3426. Name => 'FocusDistanceLower',
  3427. %focusDistanceByteSwap,
  3428. },
  3429. 0x53 => {
  3430. Name => 'WhiteBalance',
  3431. Format => 'int16u',
  3432. SeparateTable => 1,
  3433. PrintConv => \%canonWhiteBalance,
  3434. },
  3435. 0x57 => {
  3436. Name => 'ColorTemperature',
  3437. Format => 'int16u',
  3438. },
  3439. 0xa5 => {
  3440. Name => 'HighISONoiseReduction',
  3441. PrintConv => {
  3442. 0 => 'Standard',
  3443. 1 => 'Low',
  3444. 2 => 'Strong',
  3445. 3 => 'Off',
  3446. },
  3447. },
  3448. 0xee => {
  3449. Name => 'LensType',
  3450. Format => 'int16uRev', # value is big-endian
  3451. SeparateTable => 1,
  3452. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3453. PrintConv => \%canonLensTypes,
  3454. },
  3455. 0xf0 => { %ciShortFocal },
  3456. 0xf2 => { %ciLongFocal },
  3457. 0x188 => {
  3458. Name => 'FirmwareVersion',
  3459. Format => 'string[6]',
  3460. Writable => 0, # not writable for logic reasons
  3461. # some firmwares have a null instead of a space after the version number
  3462. RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
  3463. },
  3464. 0x1c7 => {
  3465. Name => 'FileIndex',
  3466. Groups => { 2 => 'Image' },
  3467. Format => 'int32u',
  3468. ValueConv => '$val + 1',
  3469. ValueConvInv => '$val - 1',
  3470. },
  3471. 0x1d3 => { #(NC)
  3472. Name => 'DirectoryIndex',
  3473. Groups => { 2 => 'Image' },
  3474. Format => 'int32u',
  3475. ValueConv => '$val - 1',
  3476. ValueConvInv => '$val + 1',
  3477. },
  3478. 0x303 => { #48
  3479. Name => 'PictureStyleInfo',
  3480. SubDirectory => {
  3481. TagTable => 'Image::ExifTool::Canon::PSInfo',
  3482. },
  3483. },
  3484. );
  3485. # Canon camera information for 40D (MakerNotes tag 0x0d) (ref PH)
  3486. %Image::ExifTool::Canon::CameraInfo40D = (
  3487. %binaryDataAttrs,
  3488. FORMAT => 'int8u',
  3489. FIRST_ENTRY => 0,
  3490. PRIORITY => 0,
  3491. IS_SUBDIR => [ 0x25b ],
  3492. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3493. NOTES => 'CameraInfo tags for the EOS 40D.',
  3494. 0x03 => { %ciFNumber }, #PH
  3495. 0x04 => { %ciExposureTime }, #PH
  3496. 0x06 => { %ciISO }, #PH
  3497. 0x15 => { #PH (580 EX II)
  3498. Name => 'FlashMeteringMode',
  3499. PrintConv => {
  3500. 0 => 'E-TTL',
  3501. 3 => 'TTL',
  3502. 4 => 'External Auto',
  3503. 5 => 'External Manual',
  3504. 6 => 'Off',
  3505. },
  3506. },
  3507. 0x18 => { %ciCameraTemperature }, #36
  3508. 0x1b => { %ciMacroMagnification }, #PH
  3509. 0x1d => { %ciFocalLength }, #PH
  3510. 0x30 => { #20
  3511. Name => 'CameraOrientation',
  3512. PrintConv => {
  3513. 0 => 'Horizontal (normal)',
  3514. 1 => 'Rotate 90 CW',
  3515. 2 => 'Rotate 270 CW',
  3516. },
  3517. },
  3518. 0x43 => { #21/24
  3519. Name => 'FocusDistanceUpper',
  3520. # this is very odd (little-endian number on odd boundary),
  3521. # but it does seem to work better with my sample images - PH
  3522. %focusDistanceByteSwap,
  3523. },
  3524. 0x45 => { #21/24
  3525. Name => 'FocusDistanceLower',
  3526. %focusDistanceByteSwap,
  3527. },
  3528. 0x6f => { #15
  3529. Name => 'WhiteBalance',
  3530. Format => 'int16u',
  3531. PrintConv => \%canonWhiteBalance,
  3532. SeparateTable => 1,
  3533. },
  3534. 0x73 => { #15
  3535. Name => 'ColorTemperature',
  3536. Format => 'int16u',
  3537. },
  3538. 0xd6 => { #15
  3539. Name => 'LensType',
  3540. Format => 'int16uRev', # value is big-endian
  3541. SeparateTable => 1,
  3542. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3543. PrintConv => \%canonLensTypes,
  3544. },
  3545. 0xd8 => { %ciShortFocal }, #15
  3546. 0xda => { %ciLongFocal }, #15
  3547. 0xff => { #15
  3548. Name => 'FirmwareVersion',
  3549. Format => 'string[6]',
  3550. },
  3551. 0x133 => { #27
  3552. Name => 'FileIndex',
  3553. Groups => { 2 => 'Image' },
  3554. Format => 'int32u',
  3555. Notes => 'combined with DirectoryIndex to give the Composite FileNumber tag',
  3556. ValueConv => '$val + 1',
  3557. ValueConvInv => '$val - 1',
  3558. },
  3559. 0x13f => { #27
  3560. Name => 'DirectoryIndex',
  3561. Groups => { 2 => 'Image' },
  3562. Format => 'int32u',
  3563. ValueConv => '$val - 1', # yes, minus (opposite to FileIndex)
  3564. ValueConvInv => '$val + 1',
  3565. },
  3566. 0x25b => {
  3567. Name => 'PictureStyleInfo',
  3568. SubDirectory => {
  3569. TagTable => 'Image::ExifTool::Canon::PSInfo',
  3570. },
  3571. },
  3572. 0x92b => { #33
  3573. Name => 'LensModel',
  3574. Format => 'string[64]',
  3575. },
  3576. );
  3577. # Canon camera information for 50D (MakerNotes tag 0x0d)
  3578. # (ref PH unless otherwise noted)
  3579. %Image::ExifTool::Canon::CameraInfo50D = (
  3580. %binaryDataAttrs,
  3581. FORMAT => 'int8u',
  3582. FIRST_ENTRY => 0,
  3583. PRIORITY => 0,
  3584. DATAMEMBER => [ 0x15a, 0x15e ],
  3585. IS_SUBDIR => [ 0x2d3, 0x2d7 ],
  3586. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3587. NOTES => 'CameraInfo tags for the EOS 50D.',
  3588. 0x03 => { %ciFNumber },
  3589. 0x04 => { %ciExposureTime },
  3590. 0x06 => { %ciISO },
  3591. 0x07 => {
  3592. Name => 'HighlightTonePriority',
  3593. PrintConv => { 0 => 'Off', 1 => 'On' },
  3594. },
  3595. 0x15 => { #PH (580 EX II)
  3596. Name => 'FlashMeteringMode',
  3597. PrintConv => {
  3598. 0 => 'E-TTL',
  3599. 3 => 'TTL',
  3600. 4 => 'External Auto',
  3601. 5 => 'External Manual',
  3602. 6 => 'Off',
  3603. },
  3604. },
  3605. 0x19 => { %ciCameraTemperature }, #36
  3606. 0x1e => { %ciFocalLength },
  3607. 0x31 => {
  3608. Name => 'CameraOrientation',
  3609. PrintConv => {
  3610. 0 => 'Horizontal (normal)',
  3611. 1 => 'Rotate 90 CW',
  3612. 2 => 'Rotate 270 CW',
  3613. },
  3614. },
  3615. 0x50 => { #33
  3616. Name => 'FocusDistanceUpper',
  3617. %focusDistanceByteSwap,
  3618. },
  3619. 0x52 => { #33
  3620. Name => 'FocusDistanceLower',
  3621. %focusDistanceByteSwap,
  3622. },
  3623. 0x6f => {
  3624. Name => 'WhiteBalance',
  3625. Format => 'int16u',
  3626. SeparateTable => 1,
  3627. PrintConv => \%canonWhiteBalance,
  3628. },
  3629. 0x73 => { #33
  3630. Name => 'ColorTemperature',
  3631. Format => 'int16u',
  3632. },
  3633. 0xa7 => {
  3634. Name => 'PictureStyle',
  3635. Format => 'int8u',
  3636. Flags => ['PrintHex','SeparateTable'],
  3637. PrintConv => \%pictureStyles,
  3638. },
  3639. 0xbd => {
  3640. Name => 'HighISONoiseReduction',
  3641. PrintConv => {
  3642. 0 => 'Standard',
  3643. 1 => 'Low',
  3644. 2 => 'Strong',
  3645. 3 => 'Off',
  3646. },
  3647. },
  3648. 0xbf => {
  3649. Name => 'AutoLightingOptimizer',
  3650. PrintConv => {
  3651. 0 => 'Standard',
  3652. 1 => 'Low',
  3653. 2 => 'Strong',
  3654. 3 => 'Off',
  3655. },
  3656. },
  3657. 0xea => { #33
  3658. Name => 'LensType',
  3659. Format => 'int16uRev', # value is big-endian
  3660. SeparateTable => 1,
  3661. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3662. PrintConv => \%canonLensTypes,
  3663. },
  3664. 0xec => { %ciShortFocal },
  3665. 0xee => { %ciLongFocal },
  3666. 0x15a => {
  3667. Name => 'FirmwareVersion',
  3668. Format => 'string[6]',
  3669. Notes => 'at this location for firmware 2.6.1',
  3670. Writable => 0,
  3671. RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmA}=$val : undef',
  3672. },
  3673. 0x15e => { #33
  3674. Name => 'FirmwareVersion',
  3675. Format => 'string[6]',
  3676. Notes => 'at this location for firmware 1.0.2, 1.0.3, 2.9.1 and 3.1.1',
  3677. Writable => 0,
  3678. RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmB}=$val : undef',
  3679. },
  3680. 0x197 => {
  3681. Name => 'FileIndex',
  3682. Condition => '$$self{CanonFirmA}',
  3683. Groups => { 2 => 'Image' },
  3684. Format => 'int32u',
  3685. ValueConv => '$val + 1',
  3686. ValueConvInv => '$val - 1',
  3687. },
  3688. 0x19b => {
  3689. Name => 'FileIndex',
  3690. Condition => '$$self{CanonFirmB}',
  3691. Groups => { 2 => 'Image' },
  3692. Format => 'int32u',
  3693. ValueConv => '$val + 1',
  3694. ValueConvInv => '$val - 1',
  3695. },
  3696. 0x1a3 => { #(NC)
  3697. Name => 'DirectoryIndex',
  3698. Condition => '$$self{CanonFirmA}',
  3699. Groups => { 2 => 'Image' },
  3700. Format => 'int32u',
  3701. ValueConv => '$val - 1',
  3702. ValueConvInv => '$val + 1',
  3703. },
  3704. 0x1a7 => { #(NC)
  3705. Name => 'DirectoryIndex',
  3706. Condition => '$$self{CanonFirmB}',
  3707. Groups => { 2 => 'Image' },
  3708. Format => 'int32u',
  3709. ValueConv => '$val - 1',
  3710. ValueConvInv => '$val + 1',
  3711. },
  3712. 0x2d3 => {
  3713. Name => 'PictureStyleInfo',
  3714. Condition => '$$self{CanonFirmA}',
  3715. SubDirectory => {
  3716. TagTable => 'Image::ExifTool::Canon::PSInfo',
  3717. },
  3718. },
  3719. 0x2d7 => {
  3720. Name => 'PictureStyleInfo',
  3721. Condition => '$$self{CanonFirmB}',
  3722. SubDirectory => {
  3723. TagTable => 'Image::ExifTool::Canon::PSInfo',
  3724. },
  3725. },
  3726. );
  3727. # Canon camera information for 60D (MakerNotes tag 0x0d)
  3728. # (ref PH unless otherwise noted)
  3729. # NOTE: Can probably borrow more 50D tags here, possibly with an offset
  3730. %Image::ExifTool::Canon::CameraInfo60D = (
  3731. %binaryDataAttrs,
  3732. FORMAT => 'int8u',
  3733. FIRST_ENTRY => 0,
  3734. PRIORITY => 0,
  3735. # DATAMEMBER => [ 0x199 ],
  3736. IS_SUBDIR => [ 0x321 ],
  3737. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3738. NOTES => 'CameraInfo tags for the EOS 60D.',
  3739. 0x03 => { %ciFNumber },
  3740. 0x04 => { %ciExposureTime },
  3741. 0x06 => { %ciISO },
  3742. 0x19 => { %ciCameraTemperature },
  3743. 0x1e => { %ciFocalLength },
  3744. 0x36 => {
  3745. Name => 'CameraOrientation',
  3746. PrintConv => {
  3747. 0 => 'Horizontal (normal)',
  3748. 1 => 'Rotate 90 CW',
  3749. 2 => 'Rotate 270 CW',
  3750. },
  3751. },
  3752. 0x55 => {
  3753. Name => 'FocusDistanceUpper',
  3754. %focusDistanceByteSwap,
  3755. },
  3756. 0x57 => {
  3757. Name => 'FocusDistanceLower',
  3758. %focusDistanceByteSwap,
  3759. },
  3760. 0x7d => {
  3761. Name => 'ColorTemperature',
  3762. Format => 'int16u',
  3763. },
  3764. 0xe8 => {
  3765. Name => 'LensType',
  3766. Format => 'int16uRev', # value is big-endian
  3767. SeparateTable => 1,
  3768. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3769. PrintConv => \%canonLensTypes,
  3770. },
  3771. 0xea => { %ciShortFocal },
  3772. 0xec => { %ciLongFocal },
  3773. 0x199 => {
  3774. Name => 'FirmwareVersion',
  3775. Format => 'string[6]',
  3776. # Notes => 'at this location for firmware 2.8.1 and 1.0.5',
  3777. Writable => 0,
  3778. # RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmA}=$val : undef',
  3779. },
  3780. 0x1d9 => {
  3781. Name => 'FileIndex',
  3782. Groups => { 2 => 'Image' },
  3783. Format => 'int32u',
  3784. ValueConv => '$val + 1',
  3785. ValueConvInv => '$val - 1',
  3786. },
  3787. 0x1e5 => { #(NC)
  3788. Name => 'DirectoryIndex',
  3789. Groups => { 2 => 'Image' },
  3790. Format => 'int32u',
  3791. ValueConv => '$val - 1',
  3792. ValueConvInv => '$val + 1',
  3793. },
  3794. 0x321 => {
  3795. Name => 'PictureStyleInfo2',
  3796. SubDirectory => {
  3797. TagTable => 'Image::ExifTool::Canon::PSInfo2',
  3798. },
  3799. },
  3800. );
  3801. # Canon camera information for 450D (MakerNotes tag 0x0d) (ref PH)
  3802. %Image::ExifTool::Canon::CameraInfo450D = (
  3803. %binaryDataAttrs,
  3804. FORMAT => 'int8u',
  3805. FIRST_ENTRY => 0,
  3806. PRIORITY => 0,
  3807. IS_SUBDIR => [ 0x263 ],
  3808. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3809. NOTES => 'CameraInfo tags for the EOS 450D.',
  3810. 0x03 => { %ciFNumber }, #PH
  3811. 0x04 => { %ciExposureTime }, #PH
  3812. 0x06 => { %ciISO }, #PH
  3813. 0x15 => { #PH (580 EX II)
  3814. Name => 'FlashMeteringMode',
  3815. PrintConv => {
  3816. 0 => 'E-TTL',
  3817. 3 => 'TTL',
  3818. 4 => 'External Auto',
  3819. 5 => 'External Manual',
  3820. 6 => 'Off',
  3821. },
  3822. },
  3823. 0x18 => { %ciCameraTemperature }, #36
  3824. 0x1b => { %ciMacroMagnification }, #PH
  3825. 0x1d => { %ciFocalLength }, #PH
  3826. 0x30 => { #20
  3827. Name => 'CameraOrientation',
  3828. PrintConv => {
  3829. 0 => 'Horizontal (normal)',
  3830. 1 => 'Rotate 90 CW',
  3831. 2 => 'Rotate 270 CW',
  3832. },
  3833. },
  3834. 0x43 => { #20
  3835. Name => 'FocusDistanceUpper',
  3836. # this is very odd (little-endian number on odd boundary),
  3837. # but it does seem to work better with my sample images - PH
  3838. %focusDistanceByteSwap,
  3839. },
  3840. 0x45 => { #20
  3841. Name => 'FocusDistanceLower',
  3842. %focusDistanceByteSwap,
  3843. },
  3844. 0x6f => { #PH
  3845. Name => 'WhiteBalance',
  3846. Format => 'int16u',
  3847. PrintConv => \%canonWhiteBalance,
  3848. SeparateTable => 1,
  3849. },
  3850. 0x73 => { #PH
  3851. Name => 'ColorTemperature',
  3852. Format => 'int16u',
  3853. },
  3854. 0xde => { #33
  3855. Name => 'LensType',
  3856. Format => 'int16uRev', # value is big-endian
  3857. SeparateTable => 1,
  3858. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3859. PrintConv => \%canonLensTypes,
  3860. },
  3861. 0x107 => { #PH
  3862. Name => 'FirmwareVersion',
  3863. Format => 'string[6]',
  3864. },
  3865. 0x10f => { #20
  3866. Name => 'OwnerName',
  3867. Format => 'string[32]',
  3868. },
  3869. 0x133 => { #20
  3870. Name => 'DirectoryIndex',
  3871. Groups => { 2 => 'Image' },
  3872. Format => 'int32u',
  3873. },
  3874. 0x13f => { #20
  3875. Name => 'FileIndex',
  3876. Groups => { 2 => 'Image' },
  3877. Format => 'int32u',
  3878. ValueConv => '$val + 1',
  3879. ValueConvInv => '$val - 1',
  3880. },
  3881. 0x263 => { #PH
  3882. Name => 'PictureStyleInfo',
  3883. SubDirectory => {
  3884. TagTable => 'Image::ExifTool::Canon::PSInfo',
  3885. },
  3886. },
  3887. 0x933 => { #33
  3888. Name => 'LensModel',
  3889. Format => 'string[64]',
  3890. },
  3891. );
  3892. # Canon camera information for 500D (MakerNotes tag 0x0d) (ref PH)
  3893. %Image::ExifTool::Canon::CameraInfo500D = (
  3894. %binaryDataAttrs,
  3895. FORMAT => 'int8u',
  3896. FIRST_ENTRY => 0,
  3897. PRIORITY => 0,
  3898. IS_SUBDIR => [ 0x30b ],
  3899. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  3900. NOTES => 'CameraInfo tags for the EOS 500D.',
  3901. 0x03 => { %ciFNumber },
  3902. 0x04 => { %ciExposureTime },
  3903. 0x06 => { %ciISO },
  3904. 0x07 => {
  3905. Name => 'HighlightTonePriority',
  3906. PrintConv => { 0 => 'Off', 1 => 'On' },
  3907. },
  3908. 0x15 => { #PH (580 EX II)
  3909. Name => 'FlashMeteringMode',
  3910. PrintConv => {
  3911. 0 => 'E-TTL',
  3912. 3 => 'TTL',
  3913. 4 => 'External Auto',
  3914. 5 => 'External Manual',
  3915. 6 => 'Off',
  3916. },
  3917. },
  3918. 0x19 => { %ciCameraTemperature },
  3919. 0x1e => { %ciFocalLength },
  3920. 0x31 => {
  3921. Name => 'CameraOrientation',
  3922. PrintConv => {
  3923. 0 => 'Horizontal (normal)',
  3924. 1 => 'Rotate 90 CW',
  3925. 2 => 'Rotate 270 CW',
  3926. },
  3927. },
  3928. 0x50 => {
  3929. Name => 'FocusDistanceUpper',
  3930. %focusDistanceByteSwap,
  3931. },
  3932. 0x52 => {
  3933. Name => 'FocusDistanceLower',
  3934. %focusDistanceByteSwap,
  3935. },
  3936. 0x73 => { # (50D + 4)
  3937. Name => 'WhiteBalance',
  3938. Format => 'int16u',
  3939. SeparateTable => 1,
  3940. PrintConv => \%canonWhiteBalance,
  3941. },
  3942. 0x77 => { # (50D + 4)
  3943. Name => 'ColorTemperature',
  3944. Format => 'int16u',
  3945. },
  3946. 0xab => { # (50D + 4)
  3947. Name => 'PictureStyle',
  3948. Format => 'int8u',
  3949. Flags => ['PrintHex','SeparateTable'],
  3950. PrintConv => \%pictureStyles,
  3951. },
  3952. 0xbc => {
  3953. Name => 'HighISONoiseReduction',
  3954. PrintConv => {
  3955. 0 => 'Standard',
  3956. 1 => 'Low',
  3957. 2 => 'Strong',
  3958. 3 => 'Off',
  3959. },
  3960. },
  3961. 0xbe => {
  3962. Name => 'AutoLightingOptimizer',
  3963. PrintConv => {
  3964. 0 => 'Standard',
  3965. 1 => 'Low',
  3966. 2 => 'Strong',
  3967. 3 => 'Off',
  3968. },
  3969. },
  3970. 0xf6 => {
  3971. Name => 'LensType',
  3972. Format => 'int16uRev', # value is big-endian
  3973. SeparateTable => 1,
  3974. ValueConvInv => 'int($val)', # (must truncate decimal part)
  3975. PrintConv => \%canonLensTypes,
  3976. },
  3977. 0xf8 => { %ciShortFocal },
  3978. 0xfa => { %ciLongFocal },
  3979. 0x190 => {
  3980. Name => 'FirmwareVersion',
  3981. Format => 'string[6]',
  3982. Writable => 0,
  3983. RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
  3984. },
  3985. 0x1d3 => {
  3986. Name => 'FileIndex',
  3987. Groups => { 2 => 'Image' },
  3988. Format => 'int32u',
  3989. ValueConv => '$val + 1',
  3990. ValueConvInv => '$val - 1',
  3991. },
  3992. 0x1df => { #(NC)
  3993. Name => 'DirectoryIndex',
  3994. Groups => { 2 => 'Image' },
  3995. Format => 'int32u',
  3996. ValueConv => '$val - 1',
  3997. ValueConvInv => '$val + 1',
  3998. },
  3999. 0x30b => {
  4000. Name => 'PictureStyleInfo',
  4001. SubDirectory => {
  4002. TagTable => 'Image::ExifTool::Canon::PSInfo',
  4003. },
  4004. },
  4005. );
  4006. # Canon camera information for 550D (MakerNotes tag 0x0d) (ref PH)
  4007. %Image::ExifTool::Canon::CameraInfo550D = (
  4008. %binaryDataAttrs,
  4009. FORMAT => 'int8u',
  4010. FIRST_ENTRY => 0,
  4011. PRIORITY => 0,
  4012. IS_SUBDIR => [ 0x31c ],
  4013. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4014. NOTES => 'CameraInfo tags for the EOS 550D.',
  4015. 0x03 => { %ciFNumber },
  4016. 0x04 => { %ciExposureTime },
  4017. 0x06 => { %ciISO },
  4018. 0x07 => { #(NC)
  4019. Name => 'HighlightTonePriority',
  4020. PrintConv => { 0 => 'Off', 1 => 'On' },
  4021. },
  4022. 0x15 => { #(NC)
  4023. Name => 'FlashMeteringMode',
  4024. PrintConv => {
  4025. 0 => 'E-TTL',
  4026. 3 => 'TTL',
  4027. 4 => 'External Auto',
  4028. 5 => 'External Manual',
  4029. 6 => 'Off',
  4030. },
  4031. },
  4032. 0x19 => { %ciCameraTemperature }, # (500D + 0)
  4033. 0x1e => { %ciFocalLength }, # (500D + 0)
  4034. 0x35 => { # (500D + 4)
  4035. Name => 'CameraOrientation',
  4036. PrintConv => {
  4037. 0 => 'Horizontal (normal)',
  4038. 1 => 'Rotate 90 CW',
  4039. 2 => 'Rotate 270 CW',
  4040. },
  4041. },
  4042. 0x54 => { # (500D + 4)
  4043. Name => 'FocusDistanceUpper',
  4044. %focusDistanceByteSwap,
  4045. },
  4046. 0x56 => { # (500D + 4)
  4047. Name => 'FocusDistanceLower',
  4048. %focusDistanceByteSwap,
  4049. },
  4050. 0x78 => { # (500D + 5) (NC)
  4051. Name => 'WhiteBalance',
  4052. Format => 'int16u',
  4053. SeparateTable => 1,
  4054. PrintConv => \%canonWhiteBalance,
  4055. },
  4056. 0x7c => { # (500D + 5)
  4057. Name => 'ColorTemperature',
  4058. Format => 'int16u',
  4059. },
  4060. 0xb0 => { # (500D + 5)
  4061. Name => 'PictureStyle',
  4062. Format => 'int8u',
  4063. Flags => ['PrintHex','SeparateTable'],
  4064. PrintConv => \%pictureStyles,
  4065. },
  4066. 0xff => { # (500D + 9)
  4067. Name => 'LensType',
  4068. Format => 'int16uRev', # value is big-endian
  4069. SeparateTable => 1,
  4070. ValueConvInv => 'int($val)', # (must truncate decimal part)
  4071. PrintConv => \%canonLensTypes,
  4072. },
  4073. 0x101 => { %ciShortFocal }, # (500D + 9)
  4074. 0x103 => { %ciLongFocal }, # (500D + 9)
  4075. 0x1a4 => { # (500D + 0x11)
  4076. Name => 'FirmwareVersion',
  4077. Format => 'string[6]',
  4078. Writable => 0,
  4079. RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
  4080. },
  4081. 0x1e4 => { # (500D + 0x11)
  4082. Name => 'FileIndex',
  4083. Groups => { 2 => 'Image' },
  4084. Format => 'int32u',
  4085. ValueConv => '$val + 1',
  4086. ValueConvInv => '$val - 1',
  4087. },
  4088. 0x1f0 => { # (500D + 0x11) (NC)
  4089. Name => 'DirectoryIndex',
  4090. Groups => { 2 => 'Image' },
  4091. Format => 'int32u',
  4092. ValueConv => '$val - 1',
  4093. ValueConvInv => '$val + 1',
  4094. },
  4095. 0x31c => { #48
  4096. Name => 'PictureStyleInfo',
  4097. SubDirectory => {
  4098. TagTable => 'Image::ExifTool::Canon::PSInfo',
  4099. },
  4100. },
  4101. );
  4102. # Canon camera information for 600D and 1100D (MakerNotes tag 0x0d) (ref PH)
  4103. %Image::ExifTool::Canon::CameraInfo600D = (
  4104. %binaryDataAttrs,
  4105. FORMAT => 'int8u',
  4106. FIRST_ENTRY => 0,
  4107. PRIORITY => 0,
  4108. IS_SUBDIR => [ 0x2fb ],
  4109. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4110. NOTES => 'CameraInfo tags for the EOS 600D and 1100D.',
  4111. 0x03 => { %ciFNumber },
  4112. 0x04 => { %ciExposureTime },
  4113. 0x06 => { %ciISO },
  4114. 0x07 => { #(NC)
  4115. Name => 'HighlightTonePriority',
  4116. PrintConv => { 0 => 'Off', 1 => 'On' },
  4117. },
  4118. 0x15 => { #(NC)
  4119. Name => 'FlashMeteringMode',
  4120. PrintConv => {
  4121. 0 => 'E-TTL',
  4122. 3 => 'TTL',
  4123. 4 => 'External Auto',
  4124. 5 => 'External Manual',
  4125. 6 => 'Off',
  4126. },
  4127. },
  4128. 0x19 => { %ciCameraTemperature }, # (60D + 0)
  4129. 0x1e => { %ciFocalLength }, # (60D + 0)
  4130. 0x38 => { # (60D + 2)
  4131. Name => 'CameraOrientation',
  4132. PrintConv => {
  4133. 0 => 'Horizontal (normal)',
  4134. 1 => 'Rotate 90 CW',
  4135. 2 => 'Rotate 270 CW',
  4136. },
  4137. },
  4138. 0x57 => { # (60D + 2, 550D + 3)
  4139. Name => 'FocusDistanceUpper',
  4140. %focusDistanceByteSwap,
  4141. },
  4142. 0x59 => { # (60D + 2, 550D + 3)
  4143. Name => 'FocusDistanceLower',
  4144. %focusDistanceByteSwap,
  4145. },
  4146. 0x7b => { # (550D + 3)
  4147. Name => 'WhiteBalance',
  4148. Format => 'int16u',
  4149. SeparateTable => 1,
  4150. PrintConv => \%canonWhiteBalance,
  4151. },
  4152. 0x7f => { # (60D + 2, 550D + 3)
  4153. Name => 'ColorTemperature',
  4154. Format => 'int16u',
  4155. },
  4156. 0xb3 => { # (550D + 3)
  4157. Name => 'PictureStyle',
  4158. Format => 'int8u',
  4159. Flags => ['PrintHex','SeparateTable'],
  4160. PrintConv => \%pictureStyles,
  4161. },
  4162. 0xea => { # (60D + 2, 550D + 3)
  4163. Name => 'LensType',
  4164. Format => 'int16uRev', # value is big-endian
  4165. SeparateTable => 1,
  4166. ValueConvInv => 'int($val)', # (must truncate decimal part)
  4167. PrintConv => \%canonLensTypes,
  4168. },
  4169. 0xec => { %ciShortFocal }, # (60D + 2)
  4170. 0xee => { %ciLongFocal }, # (60D + 2)
  4171. 0x19b => { # (60D + 2)
  4172. Name => 'FirmwareVersion',
  4173. Format => 'string[6]',
  4174. Writable => 0,
  4175. RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
  4176. },
  4177. 0x1db => { # (60D + 2) (NC)
  4178. Name => 'FileIndex',
  4179. Groups => { 2 => 'Image' },
  4180. Format => 'int32u',
  4181. ValueConv => '$val + 1',
  4182. ValueConvInv => '$val - 1',
  4183. },
  4184. 0x1e7 => { # (60D + 2) (NC)
  4185. Name => 'DirectoryIndex',
  4186. Groups => { 2 => 'Image' },
  4187. Format => 'int32u',
  4188. ValueConv => '$val - 1',
  4189. ValueConvInv => '$val + 1',
  4190. },
  4191. 0x2fb => {
  4192. Name => 'PictureStyleInfo',
  4193. SubDirectory => {
  4194. TagTable => 'Image::ExifTool::Canon::PSInfo2',
  4195. },
  4196. },
  4197. );
  4198. # Canon camera information for 1000D (MakerNotes tag 0x0d) (ref PH)
  4199. %Image::ExifTool::Canon::CameraInfo1000D = (
  4200. %binaryDataAttrs,
  4201. FORMAT => 'int8u',
  4202. FIRST_ENTRY => 0,
  4203. PRIORITY => 0,
  4204. IS_SUBDIR => [ 0x267 ],
  4205. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4206. NOTES => 'CameraInfo tags for the EOS 1000D.',
  4207. 0x03 => { %ciFNumber }, #PH
  4208. 0x04 => { %ciExposureTime }, #PH
  4209. 0x06 => { %ciISO }, #PH
  4210. 0x15 => { #PH (580 EX II)
  4211. Name => 'FlashMeteringMode',
  4212. PrintConv => {
  4213. 0 => 'E-TTL',
  4214. 3 => 'TTL',
  4215. 4 => 'External Auto',
  4216. 5 => 'External Manual',
  4217. 6 => 'Off',
  4218. },
  4219. },
  4220. 0x18 => { %ciCameraTemperature }, #36
  4221. 0x1b => { %ciMacroMagnification }, #PH (NC)
  4222. 0x1d => { %ciFocalLength }, #PH
  4223. 0x30 => { #20
  4224. Name => 'CameraOrientation',
  4225. PrintConv => {
  4226. 0 => 'Horizontal (normal)',
  4227. 1 => 'Rotate 90 CW',
  4228. 2 => 'Rotate 270 CW',
  4229. },
  4230. },
  4231. 0x43 => { #20
  4232. Name => 'FocusDistanceUpper',
  4233. %focusDistanceByteSwap,
  4234. },
  4235. 0x45 => { #20
  4236. Name => 'FocusDistanceLower',
  4237. %focusDistanceByteSwap,
  4238. },
  4239. 0x6f => { #PH
  4240. Name => 'WhiteBalance',
  4241. Format => 'int16u',
  4242. PrintConv => \%canonWhiteBalance,
  4243. SeparateTable => 1,
  4244. },
  4245. 0x73 => { #PH
  4246. Name => 'ColorTemperature',
  4247. Format => 'int16u',
  4248. },
  4249. 0xe2 => { #PH
  4250. Name => 'LensType',
  4251. Format => 'int16uRev', # value is big-endian
  4252. SeparateTable => 1,
  4253. ValueConvInv => 'int($val)', # (must truncate decimal part)
  4254. PrintConv => \%canonLensTypes,
  4255. },
  4256. 0xe4 => { %ciShortFocal }, #PH
  4257. 0xe6 => { %ciLongFocal }, #PH
  4258. 0x10b => { #PH
  4259. Name => 'FirmwareVersion',
  4260. Format => 'string[6]',
  4261. },
  4262. 0x137 => { #PH (NC)
  4263. Name => 'DirectoryIndex',
  4264. Groups => { 2 => 'Image' },
  4265. Format => 'int32u',
  4266. },
  4267. 0x143 => { #PH
  4268. Name => 'FileIndex',
  4269. Groups => { 2 => 'Image' },
  4270. Format => 'int32u',
  4271. ValueConv => '$val + 1',
  4272. ValueConvInv => '$val - 1',
  4273. },
  4274. 0x267 => { #PH
  4275. Name => 'PictureStyleInfo',
  4276. SubDirectory => {
  4277. TagTable => 'Image::ExifTool::Canon::PSInfo',
  4278. },
  4279. },
  4280. 0x937 => { #PH
  4281. Name => 'LensModel',
  4282. Format => 'string[64]',
  4283. },
  4284. );
  4285. # Canon camera information for PowerShot models (MakerNotes tag 0x0d) - PH
  4286. %Image::ExifTool::Canon::CameraInfoPowerShot = (
  4287. %binaryDataAttrs,
  4288. FORMAT => 'int32s',
  4289. FIRST_ENTRY => 0,
  4290. PRIORITY => 0,
  4291. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4292. NOTES => q{
  4293. CameraInfo tags for PowerShot models such as the A450, A460, A550, A560,
  4294. A570, A630, A640, A650, A710, A720, G7, G9, S5, SD40, SD750, SD800, SD850,
  4295. SD870, SD900, SD950, SD1000, SX100 and TX1.
  4296. },
  4297. 0x00 => {
  4298. Name => 'ISO',
  4299. Groups => { 2 => 'Image' },
  4300. ValueConv => '100*exp((($val-411)/96)*log(2))',
  4301. ValueConvInv => 'log($val/100)/log(2)*96+411',
  4302. PrintConv => 'sprintf("%.0f",$val)',
  4303. PrintConvInv => '$val',
  4304. },
  4305. 0x05 => {
  4306. Name => 'FNumber',
  4307. Groups => { 2 => 'Image' },
  4308. ValueConv => 'exp($val/192*log(2))',
  4309. ValueConvInv => 'log($val)*192/log(2)',
  4310. PrintConv => 'sprintf("%.2g",$val)',
  4311. PrintConvInv => '$val',
  4312. },
  4313. 0x06 => {
  4314. Name => 'ExposureTime',
  4315. Groups => { 2 => 'Image' },
  4316. ValueConv => 'exp(-$val/96*log(2))',
  4317. ValueConvInv => '-log($val)*96/log(2)',
  4318. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  4319. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  4320. },
  4321. 0x17 => 'Rotation', # usually the same as Orientation (but not always! why?)
  4322. # 0x25 - flash fired/not fired (ref 37)
  4323. # 0x26 - related to flash mode? (ref 37)
  4324. # 0x37 - related to flash strength (ref 37)
  4325. # 0x38 - pre-flash fired/no fired or flash data collection (ref 37)
  4326. 135 => { # [-3] <-- index relative to CameraInfoCount
  4327. Name => 'CameraTemperature',
  4328. Condition => '$$self{CameraInfoCount} == 138',
  4329. Notes => 'A450, A460, A550, A630, A640 and A710',
  4330. PrintConv => '"$val C"',
  4331. PrintConvInv => '$val=~s/ ?C//; $val',
  4332. },
  4333. 145 => { #37 [-3]
  4334. Name => 'CameraTemperature',
  4335. Condition => '$$self{CameraInfoCount} == 148',
  4336. Notes => q{
  4337. A560, A570, A650, A720, G7, G9, S5, SD40, SD750, SD800, SD850, SD870, SD900,
  4338. SD950, SD1000, SX100 and TX1
  4339. },
  4340. PrintConv => '"$val C"',
  4341. PrintConvInv => '$val=~s/ ?C//; $val',
  4342. },
  4343. );
  4344. # Canon camera information for some PowerShot models (MakerNotes tag 0x0d) - PH
  4345. %Image::ExifTool::Canon::CameraInfoPowerShot2 = (
  4346. %binaryDataAttrs,
  4347. FORMAT => 'int32s',
  4348. FIRST_ENTRY => 0,
  4349. PRIORITY => 0,
  4350. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4351. NOTES => q{
  4352. CameraInfo tags for PowerShot models such as the A470, A480, A490, A495,
  4353. A580, A590, A1000, A1100, A2000, A2100, A3000, A3100, D10, E1, G10, G11,
  4354. S90, S95, SD770, SD780, SD790, SD880, SD890, SD940, SD960, SD970, SD980,
  4355. SD990, SD1100, SD1200, SD1300, SD1400, SD3500, SD4000, SD4500, SX1, SX10,
  4356. SX20, SX110, SX120, SX130, SX200 and SX210.
  4357. },
  4358. 0x01 => {
  4359. Name => 'ISO',
  4360. Groups => { 2 => 'Image' },
  4361. ValueConv => '100*exp((($val-411)/96)*log(2))',
  4362. ValueConvInv => 'log($val/100)/log(2)*96+411',
  4363. PrintConv => 'sprintf("%.0f",$val)',
  4364. PrintConvInv => '$val',
  4365. },
  4366. 0x06 => {
  4367. Name => 'FNumber',
  4368. Groups => { 2 => 'Image' },
  4369. ValueConv => 'exp($val/192*log(2))',
  4370. ValueConvInv => 'log($val)*192/log(2)',
  4371. PrintConv => 'sprintf("%.2g",$val)',
  4372. PrintConvInv => '$val',
  4373. },
  4374. 0x07 => {
  4375. Name => 'ExposureTime',
  4376. Groups => { 2 => 'Image' },
  4377. ValueConv => 'exp(-$val/96*log(2))',
  4378. ValueConvInv => '-log($val)*96/log(2)',
  4379. PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
  4380. PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
  4381. },
  4382. 0x18 => 'Rotation',
  4383. 153 => { # [-3] <-- index relative to CameraInfoCount
  4384. Name => 'CameraTemperature',
  4385. Condition => '$$self{CameraInfoCount} == 156',
  4386. Notes => 'A470, A580, A590, SD770, SD790, SD890 and SD1100',
  4387. PrintConv => '"$val C"',
  4388. PrintConvInv => '$val=~s/ ?C//; $val',
  4389. },
  4390. 159 => { # [-3]
  4391. Name => 'CameraTemperature',
  4392. Condition => '$$self{CameraInfoCount} == 162',
  4393. Notes => 'A1000, A2000, E1, G10, SD880, SD990, SX1, SX10 and SX110',
  4394. PrintConv => '"$val C"',
  4395. PrintConvInv => '$val=~s/ ?C//; $val',
  4396. },
  4397. 164 => { # [-3]
  4398. Name => 'CameraTemperature',
  4399. Condition => '$$self{CameraInfoCount} == 167',
  4400. Notes => 'A480, A1100, A2100, D10, SD780, SD960, SD970, SD1200 and SX200',
  4401. PrintConv => '"$val C"',
  4402. PrintConvInv => '$val=~s/ ?C//; $val',
  4403. },
  4404. 168 => { # [-3]
  4405. Name => 'CameraTemperature',
  4406. Condition => '$$self{CameraInfoCount} == 171',
  4407. Notes => q{
  4408. A490, A495, A3000, A3100, G11, S90, SD940, SD980, SD1300, SD1400, SD3500,
  4409. SD4000, SX20, SX120 and SX210
  4410. },
  4411. PrintConv => '"$val C"',
  4412. PrintConvInv => '$val=~s/ ?C//; $val',
  4413. },
  4414. 261 => { # [-3]
  4415. Name => 'CameraTemperature',
  4416. Condition => '$$self{CameraInfoCount} == 264',
  4417. Notes => 'S95, SD4500 and SX130',
  4418. PrintConv => '"$val C"',
  4419. PrintConvInv => '$val=~s/ ?C//; $val',
  4420. },
  4421. );
  4422. # unknown Canon camera information (MakerNotes tag 0x0d) - PH
  4423. %Image::ExifTool::Canon::CameraInfoUnknown32 = (
  4424. %binaryDataAttrs,
  4425. FORMAT => 'int32s',
  4426. FIRST_ENTRY => 0,
  4427. PRIORITY => 0,
  4428. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4429. NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
  4430. # This tag may be uncommented, and is useful for generating
  4431. # lists of models in the "Notes" below...
  4432. # 0 => {
  4433. # Name => 'CameraInfoCount',
  4434. # ValueConv => '$$self{CameraInfoCount}',
  4435. # },
  4436. 71 => { # [-1] <-- index relative to CameraInfoCount
  4437. Name => 'CameraTemperature',
  4438. Condition => '$$self{CameraInfoCount} == 72',
  4439. Notes => 'S1',
  4440. PrintConv => '"$val C"',
  4441. PrintConvInv => '$val=~s/ ?C//; $val',
  4442. },
  4443. 83 => { # [-2]
  4444. Name => 'CameraTemperature',
  4445. Condition => '$$self{CameraInfoCount} == 85',
  4446. Notes => 'S2',
  4447. PrintConv => '"$val C"',
  4448. PrintConvInv => '$val=~s/ ?C//; $val',
  4449. },
  4450. 91 => { # [-2 or -3]
  4451. Name => 'CameraTemperature',
  4452. Condition => '$$self{CameraInfoCount} == 93 or $$self{CameraInfoCount} == 94',
  4453. Notes => 'A410, A610, A620, S80, SD30, SD400, SD430, SD450, SD500 and SD550',
  4454. PrintConv => '"$val C"',
  4455. PrintConvInv => '$val=~s/ ?C//; $val',
  4456. },
  4457. 92 => { # [-4]
  4458. Name => 'CameraTemperature',
  4459. Condition => '$$self{CameraInfoCount} == 96',
  4460. Notes => 'S3',
  4461. PrintConv => '"$val C"',
  4462. PrintConvInv => '$val=~s/ ?C//; $val',
  4463. },
  4464. 100 => { # [-4]
  4465. Name => 'CameraTemperature',
  4466. Condition => '$$self{CameraInfoCount} == 104',
  4467. Notes => 'A420, A430, A530, A540, A700, SD600, SD630 and SD700',
  4468. PrintConv => '"$val C"',
  4469. PrintConvInv => '$val=~s/ ?C//; $val',
  4470. },
  4471. 466 => { # [-3]
  4472. Name => 'CameraTemperature',
  4473. Condition => '$$self{CameraInfoCount} == 469',
  4474. Notes => '100HS, 300HS, 500HS, A1200, A2200, A3200 and A3300',
  4475. PrintConv => '"$val C"',
  4476. PrintConvInv => '$val=~s/ ?C//; $val',
  4477. },
  4478. 503 => { # [-3]
  4479. Name => 'CameraTemperature',
  4480. Condition => '$$self{CameraInfoCount} == 506',
  4481. Notes => 'A800',
  4482. PrintConv => '"$val C"',
  4483. PrintConvInv => '$val=~s/ ?C//; $val',
  4484. },
  4485. 506 => { # [-3]
  4486. Name => 'CameraTemperature',
  4487. Condition => '$$self{CameraInfoCount} == 509',
  4488. Notes => 'SX230HS',
  4489. PrintConv => '"$val C"',
  4490. PrintConvInv => '$val=~s/ ?C//; $val',
  4491. },
  4492. 520 => { # [-3]
  4493. Name => 'CameraTemperature',
  4494. Condition => '$$self{CameraInfoCount} == 523',
  4495. Notes => '310HS, 510HS, G1X, S100 (new), SX40HS and SX150',
  4496. PrintConv => '"$val C"',
  4497. PrintConvInv => '$val=~s/ ?C//; $val',
  4498. },
  4499. 524 => { # [-3]
  4500. Name => 'CameraTemperature',
  4501. Condition => '$$self{CameraInfoCount} == 527',
  4502. Notes => '110HS, 520HS, A2300, A2400, A3400, A4000, D20 and SX260HS',
  4503. PrintConv => '"$val C"',
  4504. PrintConvInv => '$val=~s/ ?C//; $val',
  4505. },
  4506. );
  4507. # unknown Canon camera information (MakerNotes tag 0x0d) - PH
  4508. %Image::ExifTool::Canon::CameraInfoUnknown16 = (
  4509. %binaryDataAttrs,
  4510. FORMAT => 'int16s',
  4511. FIRST_ENTRY => 0,
  4512. PRIORITY => 0,
  4513. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4514. );
  4515. # unknown Canon camera information (MakerNotes tag 0x0d) - PH
  4516. %Image::ExifTool::Canon::CameraInfoUnknown = (
  4517. %binaryDataAttrs,
  4518. FORMAT => 'int8s',
  4519. FIRST_ENTRY => 0,
  4520. PRIORITY => 0,
  4521. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4522. );
  4523. # Picture Style information for various cameras (ref 48)
  4524. %Image::ExifTool::Canon::PSInfo = (
  4525. %binaryDataAttrs,
  4526. FIRST_ENTRY => 0,
  4527. PRIORITY => 0,
  4528. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4529. NOTES => 'Custom picture style information for various models.',
  4530. # (values expected to be "n/a" are flagged as Unknown)
  4531. 0x00 => { Name => 'ContrastStandard', %psInfo },
  4532. 0x04 => { Name => 'SharpnessStandard', %psInfo },
  4533. 0x08 => { Name => 'SaturationStandard', %psInfo },
  4534. 0x0c => { Name => 'ColorToneStandard', %psInfo },
  4535. 0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
  4536. 0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
  4537. 0x18 => { Name => 'ContrastPortrait', %psInfo },
  4538. 0x1c => { Name => 'SharpnessPortrait', %psInfo },
  4539. 0x20 => { Name => 'SaturationPortrait', %psInfo },
  4540. 0x24 => { Name => 'ColorTonePortrait', %psInfo },
  4541. 0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
  4542. 0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
  4543. 0x30 => { Name => 'ContrastLandscape', %psInfo },
  4544. 0x34 => { Name => 'SharpnessLandscape', %psInfo },
  4545. 0x38 => { Name => 'SaturationLandscape', %psInfo },
  4546. 0x3c => { Name => 'ColorToneLandscape', %psInfo },
  4547. 0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
  4548. 0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
  4549. 0x48 => { Name => 'ContrastNeutral', %psInfo },
  4550. 0x4c => { Name => 'SharpnessNeutral', %psInfo },
  4551. 0x50 => { Name => 'SaturationNeutral', %psInfo },
  4552. 0x54 => { Name => 'ColorToneNeutral', %psInfo },
  4553. 0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
  4554. 0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
  4555. 0x60 => { Name => 'ContrastFaithful', %psInfo },
  4556. 0x64 => { Name => 'SharpnessFaithful', %psInfo },
  4557. 0x68 => { Name => 'SaturationFaithful', %psInfo },
  4558. 0x6c => { Name => 'ColorToneFaithful', %psInfo },
  4559. 0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
  4560. 0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
  4561. 0x78 => { Name => 'ContrastMonochrome', %psInfo },
  4562. 0x7c => { Name => 'SharpnessMonochrome', %psInfo },
  4563. 0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
  4564. 0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
  4565. 0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
  4566. PrintConv => {
  4567. 0 => 'None',
  4568. 1 => 'Yellow',
  4569. 2 => 'Orange',
  4570. 3 => 'Red',
  4571. 4 => 'Green',
  4572. -559038737 => 'n/a', # (0xdeadbeef)
  4573. },
  4574. },
  4575. 0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
  4576. PrintConv => {
  4577. 0 => 'None',
  4578. 1 => 'Sepia',
  4579. 2 => 'Blue',
  4580. 3 => 'Purple',
  4581. 4 => 'Green',
  4582. -559038737 => 'n/a', # (0xdeadbeef)
  4583. },
  4584. },
  4585. 0x90 => { Name => 'ContrastUserDef1', %psInfo },
  4586. 0x94 => { Name => 'SharpnessUserDef1', %psInfo },
  4587. 0x98 => { Name => 'SaturationUserDef1', %psInfo },
  4588. 0x9c => { Name => 'ColorToneUserDef1', %psInfo },
  4589. 0xa0 => { Name => 'FilterEffectUserDef1', %psInfo,
  4590. PrintConv => {
  4591. 0 => 'None',
  4592. 1 => 'Yellow',
  4593. 2 => 'Orange',
  4594. 3 => 'Red',
  4595. 4 => 'Green',
  4596. -559038737 => 'n/a', # (0xdeadbeef)
  4597. },
  4598. },
  4599. 0xa4 => { Name => 'ToningEffectUserDef1', %psInfo,
  4600. PrintConv => {
  4601. 0 => 'None',
  4602. 1 => 'Sepia',
  4603. 2 => 'Blue',
  4604. 3 => 'Purple',
  4605. 4 => 'Green',
  4606. -559038737 => 'n/a', # (0xdeadbeef)
  4607. },
  4608. },
  4609. 0xa8 => { Name => 'ContrastUserDef2', %psInfo },
  4610. 0xac => { Name => 'SharpnessUserDef2', %psInfo },
  4611. 0xb0 => { Name => 'SaturationUserDef2', %psInfo },
  4612. 0xb4 => { Name => 'ColorToneUserDef2', %psInfo },
  4613. 0xb8 => { Name => 'FilterEffectUserDef2', %psInfo,
  4614. PrintConv => {
  4615. 0 => 'None',
  4616. 1 => 'Yellow',
  4617. 2 => 'Orange',
  4618. 3 => 'Red',
  4619. 4 => 'Green',
  4620. -559038737 => 'n/a', # (0xdeadbeef)
  4621. },
  4622. },
  4623. 0xbc => { Name => 'ToningEffectUserDef2', %psInfo,
  4624. PrintConv => {
  4625. 0 => 'None',
  4626. 1 => 'Sepia',
  4627. 2 => 'Blue',
  4628. 3 => 'Purple',
  4629. 4 => 'Green',
  4630. -559038737 => 'n/a', # (0xdeadbeef)
  4631. },
  4632. },
  4633. 0xc0 => { Name => 'ContrastUserDef3', %psInfo },
  4634. 0xc4 => { Name => 'SharpnessUserDef3', %psInfo },
  4635. 0xc8 => { Name => 'SaturationUserDef3', %psInfo },
  4636. 0xcc => { Name => 'ColorToneUserDef3', %psInfo },
  4637. 0xd0 => { Name => 'FilterEffectUserDef3', %psInfo,
  4638. PrintConv => {
  4639. 0 => 'None',
  4640. 1 => 'Yellow',
  4641. 2 => 'Orange',
  4642. 3 => 'Red',
  4643. 4 => 'Green',
  4644. -559038737 => 'n/a', # (0xdeadbeef)
  4645. },
  4646. },
  4647. 0xd4 => { Name => 'ToningEffectUserDef3', %psInfo,
  4648. PrintConv => {
  4649. 0 => 'None',
  4650. 1 => 'Sepia',
  4651. 2 => 'Blue',
  4652. 3 => 'Purple',
  4653. 4 => 'Green',
  4654. -559038737 => 'n/a', # (0xdeadbeef)
  4655. },
  4656. },
  4657. # base picture style names:
  4658. 0xd8 => {
  4659. Name => 'UserDef1PictureStyle',
  4660. Format => 'int16u',
  4661. SeparateTable => 'UserDefStyle',
  4662. PrintConv => \%userDefStyles,
  4663. },
  4664. 0xda => {
  4665. Name => 'UserDef2PictureStyle',
  4666. Format => 'int16u',
  4667. SeparateTable => 'UserDefStyle',
  4668. PrintConv => \%userDefStyles,
  4669. },
  4670. 0xdc => {
  4671. Name => 'UserDef3PictureStyle',
  4672. Format => 'int16u',
  4673. SeparateTable => 'UserDefStyle',
  4674. PrintConv => \%userDefStyles,
  4675. },
  4676. );
  4677. # Picture Style information for the 60D (ref 48)
  4678. %Image::ExifTool::Canon::PSInfo2 = (
  4679. %binaryDataAttrs,
  4680. FIRST_ENTRY => 0,
  4681. PRIORITY => 0,
  4682. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4683. NOTES => 'Custom picture style information for the EOS 60D.',
  4684. # (values expected to be "n/a" are flagged as Unknown)
  4685. 0x00 => { Name => 'ContrastStandard', %psInfo },
  4686. 0x04 => { Name => 'SharpnessStandard', %psInfo },
  4687. 0x08 => { Name => 'SaturationStandard', %psInfo },
  4688. 0x0c => { Name => 'ColorToneStandard', %psInfo },
  4689. 0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
  4690. 0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
  4691. 0x18 => { Name => 'ContrastPortrait', %psInfo },
  4692. 0x1c => { Name => 'SharpnessPortrait', %psInfo },
  4693. 0x20 => { Name => 'SaturationPortrait', %psInfo },
  4694. 0x24 => { Name => 'ColorTonePortrait', %psInfo },
  4695. 0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
  4696. 0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
  4697. 0x30 => { Name => 'ContrastLandscape', %psInfo },
  4698. 0x34 => { Name => 'SharpnessLandscape', %psInfo },
  4699. 0x38 => { Name => 'SaturationLandscape', %psInfo },
  4700. 0x3c => { Name => 'ColorToneLandscape', %psInfo },
  4701. 0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
  4702. 0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
  4703. 0x48 => { Name => 'ContrastNeutral', %psInfo },
  4704. 0x4c => { Name => 'SharpnessNeutral', %psInfo },
  4705. 0x50 => { Name => 'SaturationNeutral', %psInfo },
  4706. 0x54 => { Name => 'ColorToneNeutral', %psInfo },
  4707. 0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
  4708. 0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
  4709. 0x60 => { Name => 'ContrastFaithful', %psInfo },
  4710. 0x64 => { Name => 'SharpnessFaithful', %psInfo },
  4711. 0x68 => { Name => 'SaturationFaithful', %psInfo },
  4712. 0x6c => { Name => 'ColorToneFaithful', %psInfo },
  4713. 0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
  4714. 0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
  4715. 0x78 => { Name => 'ContrastMonochrome', %psInfo },
  4716. 0x7c => { Name => 'SharpnessMonochrome', %psInfo },
  4717. 0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
  4718. 0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
  4719. 0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
  4720. PrintConv => {
  4721. 0 => 'None',
  4722. 1 => 'Yellow',
  4723. 2 => 'Orange',
  4724. 3 => 'Red',
  4725. 4 => 'Green',
  4726. -559038737 => 'n/a', # (0xdeadbeef)
  4727. },
  4728. },
  4729. 0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
  4730. PrintConv => {
  4731. 0 => 'None',
  4732. 1 => 'Sepia',
  4733. 2 => 'Blue',
  4734. 3 => 'Purple',
  4735. 4 => 'Green',
  4736. -559038737 => 'n/a', # (0xdeadbeef)
  4737. },
  4738. },
  4739. 0x90 => { Name => 'ContrastUnknown', %psInfo, Unknown => 1 },
  4740. 0x94 => { Name => 'SharpnessUnknown', %psInfo, Unknown => 1 },
  4741. 0x98 => { Name => 'SaturationUnknown', %psInfo, Unknown => 1 },
  4742. 0x9c => { Name => 'ColorToneUnknown', %psInfo, Unknown => 1 },
  4743. 0xa0 => { Name => 'FilterEffectUnknown', %psInfo, Unknown => 1,
  4744. PrintConv => {
  4745. 0 => 'None',
  4746. 1 => 'Yellow',
  4747. 2 => 'Orange',
  4748. 3 => 'Red',
  4749. 4 => 'Green',
  4750. -559038737 => 'n/a', # (0xdeadbeef)
  4751. },
  4752. },
  4753. 0xa4 => { Name => 'ToningEffectUnknown', %psInfo, Unknown => 1,
  4754. PrintConv => {
  4755. 0 => 'None',
  4756. 1 => 'Sepia',
  4757. 2 => 'Blue',
  4758. 3 => 'Purple',
  4759. 4 => 'Green',
  4760. -559038737 => 'n/a', # (0xdeadbeef)
  4761. },
  4762. },
  4763. 0xa8 => { Name => 'ContrastUserDef1', %psInfo },
  4764. 0xac => { Name => 'SharpnessUserDef1', %psInfo },
  4765. 0xb0 => { Name => 'SaturationUserDef1', %psInfo },
  4766. 0xb4 => { Name => 'ColorToneUserDef1', %psInfo },
  4767. 0xb8 => { Name => 'FilterEffectUserDef1', %psInfo,
  4768. PrintConv => {
  4769. 0 => 'None',
  4770. 1 => 'Yellow',
  4771. 2 => 'Orange',
  4772. 3 => 'Red',
  4773. 4 => 'Green',
  4774. -559038737 => 'n/a', # (0xdeadbeef)
  4775. },
  4776. },
  4777. 0xbc => { Name => 'ToningEffectUserDef1', %psInfo,
  4778. PrintConv => {
  4779. 0 => 'None',
  4780. 1 => 'Sepia',
  4781. 2 => 'Blue',
  4782. 3 => 'Purple',
  4783. 4 => 'Green',
  4784. -559038737 => 'n/a', # (0xdeadbeef)
  4785. },
  4786. },
  4787. 0xc0 => { Name => 'ContrastUserDef2', %psInfo },
  4788. 0xc4 => { Name => 'SharpnessUserDef2', %psInfo },
  4789. 0xc8 => { Name => 'SaturationUserDef2', %psInfo },
  4790. 0xcc => { Name => 'ColorToneUserDef2', %psInfo },
  4791. 0xd0 => { Name => 'FilterEffectUserDef2', %psInfo,
  4792. PrintConv => {
  4793. 0 => 'None',
  4794. 1 => 'Yellow',
  4795. 2 => 'Orange',
  4796. 3 => 'Red',
  4797. 4 => 'Green',
  4798. -559038737 => 'n/a', # (0xdeadbeef)
  4799. },
  4800. },
  4801. 0xd4 => { Name => 'ToningEffectUserDef2', %psInfo,
  4802. PrintConv => {
  4803. 0 => 'None',
  4804. 1 => 'Sepia',
  4805. 2 => 'Blue',
  4806. 3 => 'Purple',
  4807. 4 => 'Green',
  4808. -559038737 => 'n/a', # (0xdeadbeef)
  4809. },
  4810. },
  4811. 0xd8 => { Name => 'ContrastUserDef3', %psInfo },
  4812. 0xdc => { Name => 'SharpnessUserDef3', %psInfo },
  4813. 0xe0 => { Name => 'SaturationUserDef3', %psInfo },
  4814. 0xe4 => { Name => 'ColorToneUserDef3', %psInfo },
  4815. 0xe8 => { Name => 'FilterEffectUserDef3', %psInfo,
  4816. PrintConv => {
  4817. 0 => 'None',
  4818. 1 => 'Yellow',
  4819. 2 => 'Orange',
  4820. 3 => 'Red',
  4821. 4 => 'Green',
  4822. -559038737 => 'n/a', # (0xdeadbeef)
  4823. },
  4824. },
  4825. 0xec => { Name => 'ToningEffectUserDef3', %psInfo,
  4826. PrintConv => {
  4827. 0 => 'None',
  4828. 1 => 'Sepia',
  4829. 2 => 'Blue',
  4830. 3 => 'Purple',
  4831. 4 => 'Green',
  4832. -559038737 => 'n/a', # (0xdeadbeef)
  4833. },
  4834. },
  4835. # base picture style names:
  4836. 0xf0 => {
  4837. Name => 'UserDef1PictureStyle',
  4838. Format => 'int16u',
  4839. SeparateTable => 'UserDefStyle',
  4840. PrintConv => \%userDefStyles,
  4841. },
  4842. 0xf2 => {
  4843. Name => 'UserDef2PictureStyle',
  4844. Format => 'int16u',
  4845. SeparateTable => 'UserDefStyle',
  4846. PrintConv => \%userDefStyles,
  4847. },
  4848. 0xf4 => {
  4849. Name => 'UserDef3PictureStyle',
  4850. Format => 'int16u',
  4851. SeparateTable => 'UserDefStyle',
  4852. PrintConv => \%userDefStyles,
  4853. },
  4854. );
  4855. # Movie information (MakerNotes tag 0x11) (ref PH)
  4856. %Image::ExifTool::Canon::MovieInfo = (
  4857. %binaryDataAttrs,
  4858. FORMAT => 'int16u',
  4859. FIRST_ENTRY => 1,
  4860. GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
  4861. NOTES => 'Tags written by some Canon cameras when recording video.',
  4862. 1 => { # (older PowerShot AVI)
  4863. Name => 'FrameRate',
  4864. RawConv => '$val == 65535 ? undef: $val',
  4865. ValueConvInv => '$val > 65535 ? 65535 : $val',
  4866. },
  4867. 2 => { # (older PowerShot AVI)
  4868. Name => 'FrameCount',
  4869. RawConv => '$val == 65535 ? undef: $val',
  4870. ValueConvInv => '$val > 65535 ? 65535 : $val',
  4871. },
  4872. # 3 - values: 0x0001 (older PowerShot AVI), 0x4004, 0x4005
  4873. 4 => {
  4874. Name => 'FrameCount',
  4875. Format => 'int32u',
  4876. },
  4877. 6 => {
  4878. Name => 'FrameRate',
  4879. Format => 'rational32u',
  4880. PrintConv => 'int($val * 1000 + 0.5) / 1000',
  4881. PrintConvInv => '$val',
  4882. },
  4883. # 9/10 - same as 6/7 (FrameRate)
  4884. 106 => {
  4885. Name => 'Duration',
  4886. Format => 'int32u',
  4887. ValueConv => '$val / 1000',
  4888. ValueConvInv => '$val * 1000',
  4889. PrintConv => 'ConvertDuration($val)',
  4890. PrintConvInv => q{
  4891. my @a = ($val =~ /\d+(?:\.\d*)?/g);
  4892. $val = pop(@a) || 0; # seconds
  4893. $val += pop(@a) * 60 if @a; # minutes
  4894. $val += pop(@a) * 3600 if @a; # hours
  4895. return $val;
  4896. },
  4897. },
  4898. 108 => {
  4899. Name => 'AudioBitrate',
  4900. Groups => { 2 => 'Audio' },
  4901. Format => 'int32u',
  4902. PrintConv => 'ConvertBitrate($val)',
  4903. PrintConvInv => q{
  4904. $val =~ /^(\d+(?:\.\d*)?) ?([kMG]?bps)?$/ or return undef;
  4905. return $1 * {bps=>1,kbps=>1000,Mbps=>1000000,Gbps=>1000000000}->{$2 || 'bps'};
  4906. },
  4907. },
  4908. 110 => {
  4909. Name => 'AudioSampleRate',
  4910. Groups => { 2 => 'Audio' },
  4911. Format => 'int32u',
  4912. },
  4913. 112 => { # (guess)
  4914. Name => 'AudioChannels',
  4915. Groups => { 2 => 'Audio' },
  4916. Format => 'int32u',
  4917. },
  4918. # 114 - values: 0 (60D), 1 (S95)
  4919. 116 => {
  4920. Name => 'VideoCodec',
  4921. Format => 'undef[4]',
  4922. # swap bytes if little endian
  4923. RawConv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
  4924. RawConvInv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
  4925. },
  4926. # 125 - same as 10
  4927. );
  4928. # AF information (MakerNotes tag 0x12) - PH
  4929. %Image::ExifTool::Canon::AFInfo = (
  4930. PROCESS_PROC => \&ProcessSerialData,
  4931. VARS => { ID_LABEL => 'Sequence' },
  4932. FORMAT => 'int16u',
  4933. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  4934. NOTES => q{
  4935. Auto-focus information used by many older Canon models. The values in this
  4936. record are sequential, and some have variable sizes based on the value of
  4937. NumAFPoints (which may be 1,5,7,9,15,45 or 53). The AFArea coordinates are
  4938. given in a system where the image has dimensions given by AFImageWidth and
  4939. AFImageHeight, and 0,0 is the image center. The direction of the Y axis
  4940. depends on the camera model, with positive Y upwards for EOS models, but
  4941. apparently downwards for PowerShot models.
  4942. },
  4943. 0 => {
  4944. Name => 'NumAFPoints',
  4945. },
  4946. 1 => {
  4947. Name => 'ValidAFPoints',
  4948. Notes => 'number of AF points valid in the following information',
  4949. },
  4950. 2 => {
  4951. Name => 'CanonImageWidth',
  4952. Groups => { 2 => 'Image' },
  4953. },
  4954. 3 => {
  4955. Name => 'CanonImageHeight',
  4956. Groups => { 2 => 'Image' },
  4957. },
  4958. 4 => {
  4959. Name => 'AFImageWidth',
  4960. Notes => 'size of image in AF coordinates',
  4961. },
  4962. 5 => 'AFImageHeight',
  4963. 6 => 'AFAreaWidth',
  4964. 7 => 'AFAreaHeight',
  4965. 8 => {
  4966. Name => 'AFAreaXPositions',
  4967. Format => 'int16s[$val{0}]',
  4968. },
  4969. 9 => {
  4970. Name => 'AFAreaYPositions',
  4971. Format => 'int16s[$val{0}]',
  4972. },
  4973. 10 => {
  4974. Name => 'AFPointsInFocus',
  4975. Format => 'int16s[int(($val{0}+15)/16)]',
  4976. PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
  4977. },
  4978. 11 => [
  4979. {
  4980. Name => 'PrimaryAFPoint',
  4981. Condition => q{
  4982. $$self{Model} !~ /EOS/ and
  4983. (not $$self{AFInfoCount} or $$self{AFInfoCount} != 36)
  4984. },
  4985. },
  4986. {
  4987. # (some PowerShot 9-point systems put PrimaryAFPoint after 8 unknown values)
  4988. Name => 'Canon_AFInfo_0x000b',
  4989. Condition => '$$self{Model} !~ /EOS/',
  4990. Format => 'int16u[8]',
  4991. Unknown => 1,
  4992. },
  4993. # (serial processing stops here for EOS cameras)
  4994. ],
  4995. 12 => 'PrimaryAFPoint',
  4996. );
  4997. # newer AF information (MakerNotes tag 0x26) - PH (A570IS,1DmkIII,40D)
  4998. # (Note: this tag is out of sequence in A570IS maker notes)
  4999. %Image::ExifTool::Canon::AFInfo2 = (
  5000. PROCESS_PROC => \&ProcessSerialData,
  5001. VARS => { ID_LABEL => 'Sequence' },
  5002. FORMAT => 'int16u',
  5003. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5004. NOTES => q{
  5005. Newer version of the AFInfo record containing much of the same information
  5006. (and coordinate confusion) as the older version. In this record, values of
  5007. 9 and 45 have been observed for NumAFPoints.
  5008. },
  5009. 0 => {
  5010. Name => 'AFInfoSize',
  5011. Unknown => 1, # normally don't print this out
  5012. },
  5013. 1 => {
  5014. Name => 'AFAreaMode',
  5015. PrintConv => {
  5016. 0 => 'Off (Manual Focus)',
  5017. 2 => 'Single-point AF',
  5018. 4 => 'Multi-point AF or AI AF', # AiAF on A570IS
  5019. 5 => 'Face Detect AF',
  5020. 7 => 'Zone AF', #46
  5021. 8 => 'AF Point Expansion', #46
  5022. 9 => 'Spot AF', #46
  5023. },
  5024. },
  5025. 2 => {
  5026. Name => 'NumAFPoints',
  5027. RawConv => '$$self{NumAFPoints} = $val', # save for later
  5028. },
  5029. 3 => {
  5030. Name => 'ValidAFPoints',
  5031. Notes => 'number of AF points valid in the following information',
  5032. },
  5033. 4 => {
  5034. Name => 'CanonImageWidth',
  5035. Groups => { 2 => 'Image' },
  5036. },
  5037. 5 => {
  5038. Name => 'CanonImageHeight',
  5039. Groups => { 2 => 'Image' },
  5040. },
  5041. 6 => {
  5042. Name => 'AFImageWidth',
  5043. Notes => 'size of image in AF coordinates',
  5044. },
  5045. 7 => 'AFImageHeight',
  5046. 8 => {
  5047. Name => 'AFAreaWidths',
  5048. Format => 'int16s[$val{2}]',
  5049. },
  5050. 9 => {
  5051. Name => 'AFAreaHeights',
  5052. Format => 'int16s[$val{2}]',
  5053. },
  5054. 10 => {
  5055. Name => 'AFAreaXPositions',
  5056. Format => 'int16s[$val{2}]',
  5057. },
  5058. 11 => {
  5059. Name => 'AFAreaYPositions',
  5060. Format => 'int16s[$val{2}]',
  5061. },
  5062. 12 => {
  5063. Name => 'AFPointsInFocus',
  5064. Format => 'int16s[int(($val{2}+15)/16)]',
  5065. PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
  5066. },
  5067. 13 => [
  5068. {
  5069. Name => 'AFPointsSelected',
  5070. Condition => '$$self{Model} =~ /EOS/',
  5071. Format => 'int16s[int(($val{2}+15)/16)]',
  5072. PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
  5073. },
  5074. {
  5075. Name => 'Canon_AFInfo2_0x000d',
  5076. Format => 'int16s[int(($val{2}+15)/16)+1]',
  5077. Unknown => 1,
  5078. },
  5079. ],
  5080. 14 => {
  5081. # usually, but not always, the lowest number AF point in focus
  5082. Name => 'PrimaryAFPoint',
  5083. Condition => '$$self{Model} !~ /EOS/',
  5084. },
  5085. );
  5086. # my color mode information (MakerNotes tag 0x1d) - PH (A570IS)
  5087. %Image::ExifTool::Canon::MyColors = (
  5088. %binaryDataAttrs,
  5089. FORMAT => 'int16u',
  5090. FIRST_ENTRY => 0,
  5091. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  5092. 0x02 => {
  5093. Name => 'MyColorMode',
  5094. PrintConvColumns => 2,
  5095. PrintConv => {
  5096. 0 => 'Off',
  5097. 1 => 'Positive Film', #15 (SD600)
  5098. 2 => 'Light Skin Tone', #15
  5099. 3 => 'Dark Skin Tone', #15
  5100. 4 => 'Vivid Blue', #15
  5101. 5 => 'Vivid Green', #15
  5102. 6 => 'Vivid Red', #15
  5103. 7 => 'Color Accent', #15 (A610) (NC)
  5104. 8 => 'Color Swap', #15 (A610)
  5105. 9 => 'Custom',
  5106. 12 => 'Vivid',
  5107. 13 => 'Neutral',
  5108. 14 => 'Sepia',
  5109. 15 => 'B&W',
  5110. },
  5111. },
  5112. );
  5113. # face detect information (MakerNotes tag 0x24) - PH (A570IS)
  5114. %Image::ExifTool::Canon::FaceDetect1 = (
  5115. %binaryDataAttrs,
  5116. FORMAT => 'int16u',
  5117. FIRST_ENTRY => 0,
  5118. DATAMEMBER => [ 0x02 ],
  5119. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  5120. 0x02 => {
  5121. Name => 'FacesDetected',
  5122. DataMember => 'FacesDetected',
  5123. RawConv => '$$self{FacesDetected} = $val',
  5124. },
  5125. 0x03 => {
  5126. Name => 'FaceDetectFrameSize',
  5127. Format => 'int16u[2]',
  5128. },
  5129. 0x08 => {
  5130. Name => 'Face1Position',
  5131. Format => 'int16s[2]',
  5132. RawConv => '$$self{FacesDetected} < 1 ? undef: $val',
  5133. Notes => q{
  5134. X-Y coordinates for the center of each face in the Face Detect frame at the
  5135. time of focus lock. "0 0" is the center, and positive X and Y are to the
  5136. right and downwards respectively
  5137. },
  5138. },
  5139. 0x0a => {
  5140. Name => 'Face2Position',
  5141. Format => 'int16s[2]',
  5142. RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
  5143. },
  5144. 0x0c => {
  5145. Name => 'Face3Position',
  5146. Format => 'int16s[2]',
  5147. RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
  5148. },
  5149. 0x0e => {
  5150. Name => 'Face4Position',
  5151. Format => 'int16s[2]',
  5152. RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
  5153. },
  5154. 0x10 => {
  5155. Name => 'Face5Position',
  5156. Format => 'int16s[2]',
  5157. RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
  5158. },
  5159. 0x12 => {
  5160. Name => 'Face6Position',
  5161. Format => 'int16s[2]',
  5162. RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
  5163. },
  5164. 0x14 => {
  5165. Name => 'Face7Position',
  5166. Format => 'int16s[2]',
  5167. RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
  5168. },
  5169. 0x16 => {
  5170. Name => 'Face8Position',
  5171. Format => 'int16s[2]',
  5172. RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
  5173. },
  5174. 0x18 => {
  5175. Name => 'Face9Position',
  5176. Format => 'int16s[2]',
  5177. RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
  5178. },
  5179. );
  5180. # more face detect information (MakerNotes tag 0x25) - PH (A570IS)
  5181. %Image::ExifTool::Canon::FaceDetect2 = (
  5182. %binaryDataAttrs,
  5183. FORMAT => 'int8u',
  5184. FIRST_ENTRY => 0,
  5185. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  5186. 0x01 => 'FaceWidth',
  5187. 0x02 => 'FacesDetected',
  5188. );
  5189. # File number information (MakerNotes tag 0x93)
  5190. %Image::ExifTool::Canon::FileInfo = (
  5191. %binaryDataAttrs,
  5192. FORMAT => 'int16s',
  5193. FIRST_ENTRY => 1,
  5194. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  5195. 1 => [
  5196. { #5
  5197. Name => 'FileNumber',
  5198. Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
  5199. Format => 'int32u',
  5200. # Thanks to Juha Eskelinen for figuring this out:
  5201. # [this is an odd bit mapping -- it looks like the file number exists as
  5202. # a 16-bit integer containing the high bits, followed by an 8-bit integer
  5203. # with the low bits. But it is more convenient to have this in a single
  5204. # word, so some bit manipulations are necessary... - PH]
  5205. # The bit pattern of the 32-bit word is:
  5206. # 31....24 23....16 15.....8 7......0
  5207. # 00000000 ffffffff DDDDDDDD ddFFFFFF
  5208. # 0 = zero bits (not part of the file number?)
  5209. # f/F = low/high bits of file number
  5210. # d/D = low/high bits of directory number
  5211. # The directory and file number are then converted into decimal
  5212. # and separated by a '-' to give the file number used in the 20D
  5213. ValueConv => '(($val&0xffc0)>>6)*10000+(($val>>16)&0xff)+(($val&0x3f)<<8)',
  5214. ValueConvInv => q{
  5215. my $d = int($val/10000);
  5216. my $f = $val - $d * 10000;
  5217. return (($d<<6) & 0xffc0) + (($f & 0xff)<<16) + (($f>>8) & 0x3f);
  5218. },
  5219. PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
  5220. PrintConvInv => '$val=~s/-//g;$val',
  5221. },
  5222. { #16
  5223. Name => 'FileNumber',
  5224. Condition => '$$self{Model} =~ /\b(30D|400D|REBEL XTi|Kiss Digital X|K236)\b/',
  5225. Format => 'int32u',
  5226. Notes => q{
  5227. the location of the upper 4 bits of the directory number is a mystery for
  5228. the EOS 30D, so the reported directory number will be incorrect for original
  5229. images with a directory number of 164 or greater
  5230. },
  5231. # Thanks to Emil Sit for figuring this out:
  5232. # [more insane bit maniplations like the 20D/350D above, but this time we
  5233. # appear to have lost the upper 4 bits of the directory number (this was
  5234. # verified through tests with directory numbers 100, 222, 801 and 999) - PH]
  5235. # The bit pattern for the 30D is: (see 20D notes above for more information)
  5236. # 31....24 23....16 15.....8 7......0
  5237. # 00000000 ffff0000 ddddddFF FFFFFFFF
  5238. # [NOTE: the 4 high order directory bits don't appear in this record, but
  5239. # I have chosen to write them into bits 16-19 since these 4 zero bits look
  5240. # very suspicious, and are a convenient place to store this information - PH]
  5241. ValueConv => q{
  5242. my $d = ($val & 0xffc00) >> 10;
  5243. # we know there are missing bits if directory number is < 100
  5244. $d += 0x40 while $d < 100; # (repair the damage as best we can)
  5245. return $d*10000 + (($val&0x3ff)<<4) + (($val>>20)&0x0f);
  5246. },
  5247. ValueConvInv => q{
  5248. my $d = int($val/10000);
  5249. my $f = $val - $d * 10000;
  5250. return ($d << 10) + (($f>>4)&0x3ff) + (($f&0x0f)<<20);
  5251. },
  5252. PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
  5253. PrintConvInv => '$val=~s/-//g;$val',
  5254. },
  5255. { #7 (1D, 1Ds)
  5256. Name => 'ShutterCount',
  5257. Condition => 'GetByteOrder() eq "MM"',
  5258. Format => 'int32u',
  5259. },
  5260. { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
  5261. Name => 'ShutterCount',
  5262. Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
  5263. Format => 'int32u',
  5264. ValueConv => '($val>>16)|(($val&0xffff)<<16)',
  5265. ValueConvInv => '($val>>16)|(($val&0xffff)<<16)',
  5266. },
  5267. # 5D gives a single byte value (unknown)
  5268. # 40D stores all zeros
  5269. ],
  5270. 3 => { #PH
  5271. Name => 'BracketMode',
  5272. PrintConv => {
  5273. 0 => 'Off',
  5274. 1 => 'AEB',
  5275. 2 => 'FEB',
  5276. 3 => 'ISO',
  5277. 4 => 'WB',
  5278. },
  5279. },
  5280. 4 => 'BracketValue', #PH
  5281. 5 => 'BracketShotNumber', #PH
  5282. 6 => { #PH
  5283. Name => 'RawJpgQuality',
  5284. RawConv => '$val<=0 ? undef : $val',
  5285. PrintConv => \%canonQuality,
  5286. },
  5287. 7 => { #PH
  5288. Name => 'RawJpgSize',
  5289. RawConv => '$val<0 ? undef : $val',
  5290. PrintConv => \%canonImageSize,
  5291. },
  5292. 8 => { #PH
  5293. Name => 'LongExposureNoiseReduction2',
  5294. Notes => q{
  5295. for some modules this gives the long exposure noise reduction applied to the
  5296. image, but for other models this just reflects the setting independent of
  5297. whether or not it was applied
  5298. },
  5299. RawConv => '$val<0 ? undef : $val',
  5300. PrintConv => {
  5301. 0 => 'Off',
  5302. 1 => 'On (1D)',
  5303. 3 => 'On',
  5304. 4 => 'Auto',
  5305. },
  5306. },
  5307. 9 => { #PH
  5308. Name => 'WBBracketMode',
  5309. PrintConv => {
  5310. 0 => 'Off',
  5311. 1 => 'On (shift AB)',
  5312. 2 => 'On (shift GM)',
  5313. },
  5314. },
  5315. 12 => 'WBBracketValueAB', #PH
  5316. 13 => 'WBBracketValueGM', #PH
  5317. 14 => { #PH
  5318. Name => 'FilterEffect',
  5319. RawConv => '$val==-1 ? undef : $val',
  5320. PrintConv => {
  5321. 0 => 'None',
  5322. 1 => 'Yellow',
  5323. 2 => 'Orange',
  5324. 3 => 'Red',
  5325. 4 => 'Green',
  5326. },
  5327. },
  5328. 15 => { #PH
  5329. Name => 'ToningEffect',
  5330. RawConv => '$val==-1 ? undef : $val',
  5331. PrintConv => {
  5332. 0 => 'None',
  5333. 1 => 'Sepia',
  5334. 2 => 'Blue',
  5335. 3 => 'Purple',
  5336. 4 => 'Green',
  5337. },
  5338. },
  5339. 16 => { #PH
  5340. %ciMacroMagnification,
  5341. # MP-E 65mm on 5DmkII: 44=5x,52~=3.9x,56~=3.3x,62~=2.6x,75=1x
  5342. # ME-E 65mm on 40D/450D: 72 for all samples (not valid)
  5343. Condition => q{
  5344. $$self{LensType} and $$self{LensType} == 124 and
  5345. $$self{Model} !~ /\b(40D|450D|REBEL XSi|Kiss X2)\b/
  5346. },
  5347. Notes => q{
  5348. currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo, and not
  5349. valid for all camera models
  5350. },
  5351. },
  5352. # 17 - values: 0, 3, 4
  5353. # 18 - same as LiveViewShooting for all my samples (5DmkII, 50D) - PH
  5354. 19 => { #PH
  5355. # Note: this value is not displayed by Canon ImageBrowser for the following
  5356. # models with the live view feature: 1DmkIII, 1DSmkIII, 40D, 450D, 1000D
  5357. # (this tag could be valid only for some firmware versions:
  5358. # http://www.breezesys.com/forum/showthread.php?p=16980)
  5359. Name => 'LiveViewShooting',
  5360. PrintConv => { 0 => 'Off', 1 => 'On' },
  5361. },
  5362. # 22 - values: 0, 1
  5363. # 23 - values: 0, 21, 22
  5364. 25 => { #PH
  5365. Name => 'FlashExposureLock',
  5366. PrintConv => { 0 => 'Off', 1 => 'On' },
  5367. },
  5368. );
  5369. # Internal serial number information (MakerNotes tag 0x96) (ref PH)
  5370. %Image::ExifTool::Canon::SerialInfo = (
  5371. %binaryDataAttrs,
  5372. FIRST_ENTRY => 0,
  5373. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5374. 9 => {
  5375. Name => 'InternalSerialNumber',
  5376. Format => 'string',
  5377. },
  5378. );
  5379. # Cropping information (MakerNotes tag 0x98) (ref PH)
  5380. %Image::ExifTool::Canon::CropInfo = (
  5381. %binaryDataAttrs,
  5382. FORMAT => 'int16u',
  5383. FIRST_ENTRY => 0,
  5384. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5385. 0 => 'CropLeftMargin', # (NC, may be right)
  5386. 1 => 'CropRightMargin',
  5387. 2 => 'CropTopMargin', # (NC, may be bottom)
  5388. 3 => 'CropBottomMargin',
  5389. );
  5390. # Aspect ratio information (MakerNotes tag 0x9a) (ref PH)
  5391. %Image::ExifTool::Canon::AspectInfo = (
  5392. %binaryDataAttrs,
  5393. FORMAT => 'int32u',
  5394. FIRST_ENTRY => 0,
  5395. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5396. 0 => {
  5397. Name => 'AspectRatio',
  5398. PrintConv => {
  5399. 0 => '3:2',
  5400. 1 => '1:1',
  5401. 2 => '4:3',
  5402. 7 => '16:9',
  5403. 8 => '4:5',
  5404. },
  5405. },
  5406. 1 => 'CroppedImageWidth', # (could use a better name for these)
  5407. 2 => 'CroppedImageHeight',
  5408. );
  5409. # Color information (MakerNotes tag 0xa0)
  5410. %Image::ExifTool::Canon::Processing = (
  5411. %binaryDataAttrs,
  5412. FORMAT => 'int16s',
  5413. FIRST_ENTRY => 1,
  5414. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  5415. 1 => { #PH
  5416. Name => 'ToneCurve',
  5417. PrintConv => {
  5418. 0 => 'Standard',
  5419. 1 => 'Manual',
  5420. 2 => 'Custom',
  5421. },
  5422. },
  5423. 2 => { #12
  5424. Name => 'Sharpness',
  5425. Notes => 'all models except the 20D and 350D',
  5426. Condition => '$$self{Model} !~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
  5427. Priority => 0, # (maybe not as reliable as other sharpness values)
  5428. },
  5429. 3 => { #PH
  5430. Name => 'SharpnessFrequency', # PatternSharpness?
  5431. PrintConvColumns => 2,
  5432. PrintConv => {
  5433. 0 => 'n/a',
  5434. 1 => 'Lowest',
  5435. 2 => 'Low',
  5436. 3 => 'Standard',
  5437. 4 => 'High',
  5438. 5 => 'Highest',
  5439. },
  5440. },
  5441. 4 => 'SensorRedLevel', #PH
  5442. 5 => 'SensorBlueLevel', #PH
  5443. 6 => 'WhiteBalanceRed', #PH
  5444. 7 => 'WhiteBalanceBlue', #PH
  5445. 8 => { #PH
  5446. Name => 'WhiteBalance',
  5447. RawConv => '$val < 0 ? undef : $val',
  5448. PrintConv => \%canonWhiteBalance,
  5449. SeparateTable => 1,
  5450. },
  5451. 9 => 'ColorTemperature', #6
  5452. 10 => { #12
  5453. Name => 'PictureStyle',
  5454. Flags => ['PrintHex','SeparateTable'],
  5455. PrintConv => \%pictureStyles,
  5456. },
  5457. 11 => { #PH
  5458. Name => 'DigitalGain',
  5459. ValueConv => '$val / 10',
  5460. ValueConvInv => '$val * 10',
  5461. },
  5462. 12 => { #PH
  5463. Name => 'WBShiftAB',
  5464. Notes => 'positive is a shift toward amber',
  5465. },
  5466. 13 => { #PH
  5467. Name => 'WBShiftGM',
  5468. Notes => 'positive is a shift toward green',
  5469. },
  5470. );
  5471. # Color balance information (MakerNotes tag 0xa9) (ref PH)
  5472. %Image::ExifTool::Canon::ColorBalance = (
  5473. %binaryDataAttrs,
  5474. NOTES => 'These tags are used by the 10D and 300D.',
  5475. FORMAT => 'int16s',
  5476. FIRST_ENTRY => 0,
  5477. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5478. # red,green1,green2,blue (ref 2)
  5479. 0 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
  5480. 4 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
  5481. 8 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
  5482. 12 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
  5483. 16 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
  5484. 20 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
  5485. 24 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
  5486. 28 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
  5487. 32 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
  5488. );
  5489. # Measured color levels (MakerNotes tag 0xaa) (ref 37)
  5490. %Image::ExifTool::Canon::MeasuredColor = (
  5491. %binaryDataAttrs,
  5492. FORMAT => 'int16u',
  5493. FIRST_ENTRY => 1,
  5494. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5495. 1 => {
  5496. # this is basically the inverse of WB_RGGBLevelsMeasured (ref 37)
  5497. Name => 'MeasuredRGGB',
  5498. Format => 'int16u[4]',
  5499. },
  5500. # 5 - observed values: 0, 1 - PH
  5501. );
  5502. # Flags information (MakerNotes tag 0xb0) (ref PH)
  5503. %Image::ExifTool::Canon::Flags = (
  5504. %binaryDataAttrs,
  5505. FORMAT => 'int16s',
  5506. FIRST_ENTRY => 1,
  5507. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5508. 1 => 'ModifiedParamFlag',
  5509. );
  5510. # Modified information (MakerNotes tag 0xb1) (ref PH)
  5511. %Image::ExifTool::Canon::ModifiedInfo = (
  5512. %binaryDataAttrs,
  5513. FORMAT => 'int16s',
  5514. FIRST_ENTRY => 1,
  5515. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5516. 1 => {
  5517. Name => 'ModifiedToneCurve',
  5518. PrintConv => {
  5519. 0 => 'Standard',
  5520. 1 => 'Manual',
  5521. 2 => 'Custom',
  5522. },
  5523. },
  5524. 2 => {
  5525. Name => 'ModifiedSharpness',
  5526. Notes => '1D and 5D only',
  5527. Condition => '$$self{Model} =~ /\b(1D|5D)/',
  5528. },
  5529. 3 => {
  5530. Name => 'ModifiedSharpnessFreq', # ModifiedPatternSharpness?
  5531. PrintConv => {
  5532. 0 => 'n/a',
  5533. 1 => 'Lowest',
  5534. 2 => 'Low',
  5535. 3 => 'Standard',
  5536. 4 => 'High',
  5537. 5 => 'Highest',
  5538. },
  5539. },
  5540. 4 => 'ModifiedSensorRedLevel',
  5541. 5 => 'ModifiedSensorBlueLevel',
  5542. 6 => 'ModifiedWhiteBalanceRed',
  5543. 7 => 'ModifiedWhiteBalanceBlue',
  5544. 8 => {
  5545. Name => 'ModifiedWhiteBalance',
  5546. PrintConv => \%canonWhiteBalance,
  5547. SeparateTable => 'WhiteBalance',
  5548. },
  5549. 9 => 'ModifiedColorTemp',
  5550. 10 => {
  5551. Name => 'ModifiedPictureStyle',
  5552. PrintHex => 1,
  5553. SeparateTable => 'PictureStyle',
  5554. PrintConv => \%pictureStyles,
  5555. },
  5556. 11 => {
  5557. Name => 'ModifiedDigitalGain',
  5558. ValueConv => '$val / 10',
  5559. ValueConvInv => '$val * 10',
  5560. },
  5561. );
  5562. # Preview image information (MakerNotes tag 0xb6)
  5563. # - The 300D writes a 1536x1024 preview image that is accessed
  5564. # through this information - decoded by PH 12/14/03
  5565. %Image::ExifTool::Canon::PreviewImageInfo = (
  5566. %binaryDataAttrs,
  5567. FORMAT => 'int32u',
  5568. FIRST_ENTRY => 1,
  5569. IS_OFFSET => [ 5 ], # tag 5 is 'IsOffset'
  5570. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  5571. # the size of the preview block in 2-byte increments
  5572. # 0 => {
  5573. # Name => 'PreviewImageInfoWords',
  5574. # },
  5575. 1 => {
  5576. Name => 'PreviewQuality',
  5577. PrintConv => \%canonQuality,
  5578. },
  5579. 2 => {
  5580. Name => 'PreviewImageLength',
  5581. OffsetPair => 5, # point to associated offset
  5582. DataTag => 'PreviewImage',
  5583. Protected => 2,
  5584. },
  5585. 3 => 'PreviewImageWidth',
  5586. 4 => 'PreviewImageHeight',
  5587. 5 => {
  5588. Name => 'PreviewImageStart',
  5589. Flags => 'IsOffset',
  5590. OffsetPair => 2, # associated byte count tagID
  5591. DataTag => 'PreviewImage',
  5592. Protected => 2,
  5593. },
  5594. # NOTE: The size of the PreviewImageInfo structure is incorrectly
  5595. # written as 48 bytes (Count=12, Format=int32u), but only the first
  5596. # 6 int32u values actually exist
  5597. );
  5598. # Sensor information (MakerNotes tag 0xe0) (ref 12)
  5599. %Image::ExifTool::Canon::SensorInfo = (
  5600. PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
  5601. FORMAT => 'int16s',
  5602. FIRST_ENTRY => 1,
  5603. GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
  5604. # Note: Don't make these writable because it confuses Canon decoding software
  5605. # if these are changed
  5606. 1 => 'SensorWidth',
  5607. 2 => 'SensorHeight',
  5608. 5 => 'SensorLeftBorder', #2
  5609. 6 => 'SensorTopBorder', #2
  5610. 7 => 'SensorRightBorder', #2
  5611. 8 => 'SensorBottomBorder', #2
  5612. 9 => { #22
  5613. Name => 'BlackMaskLeftBorder',
  5614. Notes => q{
  5615. coordinates for the area to the left or right of the image used to calculate
  5616. the average black level
  5617. },
  5618. },
  5619. 10 => 'BlackMaskTopBorder', #22
  5620. 11 => 'BlackMaskRightBorder', #22
  5621. 12 => 'BlackMaskBottomBorder', #22
  5622. );
  5623. # Color data (MakerNotes tag 0x4001, count=582) (ref 12)
  5624. %Image::ExifTool::Canon::ColorData1 = (
  5625. %binaryDataAttrs,
  5626. NOTES => 'These tags are used by the 20D and 350D.',
  5627. FORMAT => 'int16s',
  5628. FIRST_ENTRY => 0,
  5629. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5630. IS_SUBDIR => [ 0x4b ],
  5631. # 0x00: size of record in bytes - PH
  5632. # (dcraw 8.81 uses index 0x19 for WB)
  5633. 0x19 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
  5634. 0x1d => 'ColorTempAsShot',
  5635. 0x1e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
  5636. 0x22 => 'ColorTempAuto',
  5637. 0x23 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
  5638. 0x27 => 'ColorTempDaylight',
  5639. 0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
  5640. 0x2c => 'ColorTempShade',
  5641. 0x2d => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
  5642. 0x31 => 'ColorTempCloudy',
  5643. 0x32 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
  5644. 0x36 => 'ColorTempTungsten',
  5645. 0x37 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
  5646. 0x3b => 'ColorTempFluorescent',
  5647. 0x3c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
  5648. 0x40 => 'ColorTempFlash',
  5649. 0x41 => { Name => 'WB_RGGBLevelsCustom1', Format => 'int16s[4]' },
  5650. 0x45 => 'ColorTempCustom1',
  5651. 0x46 => { Name => 'WB_RGGBLevelsCustom2', Format => 'int16s[4]' },
  5652. 0x4a => 'ColorTempCustom2',
  5653. 0x4b => { #PH
  5654. Name => 'ColorCalib',
  5655. Format => 'undef[120]',
  5656. Unknown => 1, # (all tags are unknown, so we can avoid processing entire directory)
  5657. Notes => 'A, B, C, Temperature',
  5658. SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
  5659. },
  5660. );
  5661. # Color data (MakerNotes tag 0x4001, count=653) (ref 12)
  5662. %Image::ExifTool::Canon::ColorData2 = (
  5663. %binaryDataAttrs,
  5664. NOTES => 'These tags are used by the 1DmkII and 1DSmkII.',
  5665. FORMAT => 'int16s',
  5666. FIRST_ENTRY => 0,
  5667. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5668. IS_SUBDIR => [ 0xa4 ],
  5669. 0x18 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
  5670. 0x1c => 'ColorTempAuto',
  5671. 0x1d => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
  5672. 0x21 => { Name => 'ColorTempUnknown', Unknown => 1 },
  5673. # (dcraw 8.81 uses index 0x22 for WB)
  5674. 0x22 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
  5675. 0x26 => 'ColorTempAsShot',
  5676. 0x27 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
  5677. 0x2b => 'ColorTempDaylight',
  5678. 0x2c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
  5679. 0x30 => 'ColorTempShade',
  5680. 0x31 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
  5681. 0x35 => 'ColorTempCloudy',
  5682. 0x36 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
  5683. 0x3a => 'ColorTempTungsten',
  5684. 0x3b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
  5685. 0x3f => 'ColorTempFluorescent',
  5686. 0x40 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
  5687. 0x44 => 'ColorTempKelvin',
  5688. 0x45 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
  5689. 0x49 => 'ColorTempFlash',
  5690. 0x4a => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
  5691. 0x4e => { Name => 'ColorTempUnknown2', Unknown => 1 },
  5692. 0x4f => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
  5693. 0x53 => { Name => 'ColorTempUnknown3', Unknown => 1 },
  5694. 0x54 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
  5695. 0x58 => { Name => 'ColorTempUnknown4', Unknown => 1 },
  5696. 0x59 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
  5697. 0x5d => { Name => 'ColorTempUnknown5', Unknown => 1 },
  5698. 0x5e => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
  5699. 0x62 => { Name => 'ColorTempUnknown6', Unknown => 1 },
  5700. 0x63 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
  5701. 0x67 => { Name => 'ColorTempUnknown7', Unknown => 1 },
  5702. 0x68 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
  5703. 0x6c => { Name => 'ColorTempUnknown8', Unknown => 1 },
  5704. 0x6d => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
  5705. 0x71 => { Name => 'ColorTempUnknown9', Unknown => 1 },
  5706. 0x72 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
  5707. 0x76 => { Name => 'ColorTempUnknown10', Unknown => 1 },
  5708. 0x77 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
  5709. 0x7b => { Name => 'ColorTempUnknown11', Unknown => 1 },
  5710. 0x7c => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
  5711. 0x80 => { Name => 'ColorTempUnknown12', Unknown => 1 },
  5712. 0x81 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
  5713. 0x85 => { Name => 'ColorTempUnknown13', Unknown => 1 },
  5714. 0x86 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
  5715. 0x8a => { Name => 'ColorTempUnknown14', Unknown => 1 },
  5716. 0x8b => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
  5717. 0x8f => { Name => 'ColorTempUnknown15', Unknown => 1 },
  5718. 0x90 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
  5719. 0x94 => 'ColorTempPC1',
  5720. 0x95 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
  5721. 0x99 => 'ColorTempPC2',
  5722. 0x9a => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
  5723. 0x9e => 'ColorTempPC3',
  5724. 0x9f => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
  5725. 0xa3 => { Name => 'ColorTempUnknown16', Unknown => 1 },
  5726. 0xa4 => { #PH
  5727. Name => 'ColorCalib',
  5728. Format => 'undef[120]',
  5729. Unknown => 1,
  5730. Notes => 'A, B, C, Temperature',
  5731. SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
  5732. },
  5733. 0x26a => { #PH
  5734. Name => 'RawMeasuredRGGB',
  5735. Format => 'int32u[4]',
  5736. Notes => 'raw MeasuredRGGB values, before normalization',
  5737. # swap words because the word ordering is big-endian, opposite to the byte ordering
  5738. ValueConv => \&SwapWords,
  5739. ValueConvInv => \&SwapWords,
  5740. },
  5741. );
  5742. # Color data (MakerNotes tag 0x4001, count=796) (ref 12)
  5743. %Image::ExifTool::Canon::ColorData3 = (
  5744. %binaryDataAttrs,
  5745. NOTES => 'These tags are used by the 1DmkIIN, 5D, 30D and 400D.',
  5746. FORMAT => 'int16s',
  5747. FIRST_ENTRY => 0,
  5748. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5749. IS_SUBDIR => [ 0x85 ],
  5750. 0x00 => { #PH
  5751. Name => 'ColorDataVersion',
  5752. PrintConv => {
  5753. 1 => '1 (1DmkIIN/5D/30D/400D)',
  5754. },
  5755. },
  5756. # 0x01-0x3e: RGGB coefficients, apparently specific to the
  5757. # individual camera and possibly used for color calibration (ref 37)
  5758. # (dcraw 8.81 uses index 0x3f for WB)
  5759. 0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
  5760. 0x43 => 'ColorTempAsShot',
  5761. 0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
  5762. 0x48 => 'ColorTempAuto',
  5763. # not sure exactly what 'Measured' values mean...
  5764. 0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
  5765. 0x4d => 'ColorTempMeasured',
  5766. 0x4e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
  5767. 0x52 => 'ColorTempDaylight',
  5768. 0x53 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
  5769. 0x57 => 'ColorTempShade',
  5770. 0x58 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
  5771. 0x5c => 'ColorTempCloudy',
  5772. 0x5d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
  5773. 0x61 => 'ColorTempTungsten',
  5774. 0x62 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
  5775. 0x66 => 'ColorTempFluorescent',
  5776. 0x67 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
  5777. 0x6b => 'ColorTempKelvin',
  5778. 0x6c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
  5779. 0x70 => 'ColorTempFlash',
  5780. 0x71 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
  5781. 0x75 => 'ColorTempPC1',
  5782. 0x76 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
  5783. 0x7a => 'ColorTempPC2',
  5784. 0x7b => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
  5785. 0x7f => 'ColorTempPC3',
  5786. 0x80 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
  5787. 0x84 => 'ColorTempCustom',
  5788. 0x85 => { #37
  5789. Name => 'ColorCalib',
  5790. Format => 'undef[120]',
  5791. Unknown => 1,
  5792. Notes => 'B, C, A, Temperature',
  5793. SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
  5794. },
  5795. # 0xc5-0xc7: looks like black levels (ref 37)
  5796. # 0xc8-0x1c7: some sort of color table (ref 37)
  5797. 0x248 => { #37
  5798. Name => 'FlashOutput',
  5799. ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
  5800. ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
  5801. PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
  5802. PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
  5803. },
  5804. 0x249 => { #37
  5805. Name => 'FlashBatteryLevel',
  5806. # calibration points for external flash: 144=3.76V (almost empty), 192=5.24V (full)
  5807. # - have seen a value of 201 with internal flash
  5808. PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
  5809. PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
  5810. },
  5811. 0x24a => { #37
  5812. Name => 'ColorTempFlashData',
  5813. # 0 for no external flash, 35980 for 'Strobe or Misfire'
  5814. # (lower than ColorTempFlash by up to 200 degrees)
  5815. RawConv => '($val < 2000 or $val > 12000) ? undef : $val',
  5816. },
  5817. # 0x24b: inverse relationship with flash power (ref 37)
  5818. # 0x286: has value 256 for correct exposure, less for under exposure (seen 96 minimum) (ref 37)
  5819. 0x287 => { #37
  5820. Name => 'MeasuredRGGBData',
  5821. Format => 'int32u[4]',
  5822. Notes => 'MeasuredRGGB may be derived from these data values',
  5823. # swap words because the word ordering is big-endian, opposite to the byte ordering
  5824. ValueConv => \&SwapWords,
  5825. ValueConvInv => \&SwapWords,
  5826. },
  5827. # 0x297: ranges from -10 to 30, higher for high ISO (ref 37)
  5828. );
  5829. # Color data (MakerNotes tag 0x4001, count=674|692|702|1227|1250|1251|1337|1338|1346) (ref PH)
  5830. %Image::ExifTool::Canon::ColorData4 = (
  5831. %binaryDataAttrs,
  5832. NOTES => q{
  5833. These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
  5834. 450D, 500D, 550D, 1000D and 1100D.
  5835. },
  5836. FORMAT => 'int16s',
  5837. FIRST_ENTRY => 0,
  5838. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5839. IS_SUBDIR => [ 0x3f, 0xa8 ],
  5840. 0x00 => {
  5841. Name => 'ColorDataVersion',
  5842. PrintConv => {
  5843. 2 => '2 (1DmkIII)',
  5844. 3 => '3 (40D)',
  5845. 4 => '4 (1DSmkIII)',
  5846. 5 => '5 (450D/1000D)',
  5847. 6 => '6 (50D/5DmkII)',
  5848. 7 => '7 (500D/550D/7D/1DmkIV)',
  5849. 9 => '9 (1100D)',
  5850. },
  5851. },
  5852. # 0x01-0x18: unknown RGGB coefficients (int16s[4]) (50D)
  5853. # (dcraw 8.81 uses index 0x3f for WB)
  5854. 0x3f => {
  5855. Name => 'ColorCoefs',
  5856. Format => 'undef[210]', # ColorTempUnknown11 is last entry
  5857. SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
  5858. },
  5859. 0xa8 => {
  5860. Name => 'ColorCalib',
  5861. Format => 'undef[120]',
  5862. Unknown => 1,
  5863. Notes => 'B, C, A, Temperature',
  5864. SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
  5865. },
  5866. 0x280 => { #PH
  5867. Name => 'RawMeasuredRGGB',
  5868. Format => 'int32u[4]',
  5869. Notes => 'raw MeasuredRGGB values, before normalization',
  5870. # swap words because the word ordering is big-endian, opposite to the byte ordering
  5871. ValueConv => \&SwapWords,
  5872. ValueConvInv => \&SwapWords,
  5873. },
  5874. );
  5875. # color coefficients (ref PH)
  5876. %Image::ExifTool::Canon::ColorCoefs = (
  5877. %binaryDataAttrs,
  5878. FORMAT => 'int16s',
  5879. FIRST_ENTRY => 0,
  5880. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5881. 0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
  5882. 0x04 => 'ColorTempAsShot',
  5883. 0x05 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
  5884. 0x09 => 'ColorTempAuto',
  5885. 0x0a => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
  5886. 0x0e => 'ColorTempMeasured',
  5887. # the following Unknown values are set for the 50D and 5DmkII, and the
  5888. # SRAW images of the 40D, and affect thumbnail display for the 50D/5DmkII
  5889. # and conversion for all modes of the 40D
  5890. 0x0f => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
  5891. 0x13 => { Name => 'ColorTempUnknown', Unknown => 1 },
  5892. 0x14 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
  5893. 0x18 => 'ColorTempDaylight',
  5894. 0x19 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
  5895. 0x1d => 'ColorTempShade',
  5896. 0x1e => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
  5897. 0x22 => 'ColorTempCloudy',
  5898. 0x23 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
  5899. 0x27 => 'ColorTempTungsten',
  5900. 0x28 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
  5901. 0x2c => 'ColorTempFluorescent',
  5902. # (changing the Kelvin values has no effect on image in DPP... why not?)
  5903. 0x2d => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
  5904. 0x31 => 'ColorTempKelvin',
  5905. 0x32 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
  5906. 0x36 => 'ColorTempFlash',
  5907. 0x37 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
  5908. 0x3b => { Name => 'ColorTempUnknown2', Unknown => 1 },
  5909. 0x3c => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
  5910. 0x40 => { Name => 'ColorTempUnknown3', Unknown => 1 },
  5911. 0x41 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
  5912. 0x45 => { Name => 'ColorTempUnknown4', Unknown => 1 },
  5913. 0x46 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
  5914. 0x4a => { Name => 'ColorTempUnknown5', Unknown => 1 },
  5915. 0x4b => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
  5916. 0x4f => { Name => 'ColorTempUnknown6', Unknown => 1 },
  5917. 0x50 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
  5918. 0x54 => { Name => 'ColorTempUnknown7', Unknown => 1 },
  5919. 0x55 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
  5920. 0x59 => { Name => 'ColorTempUnknown8', Unknown => 1 },
  5921. 0x5a => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
  5922. 0x5e => { Name => 'ColorTempUnknown9', Unknown => 1 },
  5923. 0x5f => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
  5924. 0x63 => { Name => 'ColorTempUnknown10', Unknown => 1 },
  5925. 0x64 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
  5926. 0x68 => { Name => 'ColorTempUnknown11', Unknown => 1 },
  5927. 0x69 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
  5928. 0x6d => { Name => 'ColorTempUnknown12', Unknown => 1 },
  5929. 0x6e => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
  5930. 0x72 => { Name => 'ColorTempUnknown13', Unknown => 1 },
  5931. );
  5932. # color calibration (ref 37)
  5933. %Image::ExifTool::Canon::ColorCalib = (
  5934. %binaryDataAttrs,
  5935. FORMAT => 'int16s',
  5936. FIRST_ENTRY => 0,
  5937. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5938. # these coefficients are in a different order compared to older
  5939. # models (A,B,C in ColorData1/2 vs. C,A,B in ColorData3/4) - PH
  5940. # Coefficient A most closely matches the blue curvature, and
  5941. # coefficient B most closely matches the red curvature, but the match
  5942. # is not perfect, and I don't know what coefficient C is for (certainly
  5943. # not a green coefficient) - PH
  5944. NOTES => q{
  5945. Camera color calibration data. For the 20D, 350D, 1DmkII and 1DSmkII the
  5946. order of the cooefficients is A, B, C, Temperature, but for newer models it
  5947. is B, C, A, Temperature. These tags are extracted only when the Unknown
  5948. option is used.
  5949. },
  5950. 0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration },
  5951. 0x04 => { Name => 'CameraColorCalibration02', %cameraColorCalibration },
  5952. 0x08 => { Name => 'CameraColorCalibration03', %cameraColorCalibration },
  5953. 0x0c => { Name => 'CameraColorCalibration04', %cameraColorCalibration },
  5954. 0x10 => { Name => 'CameraColorCalibration05', %cameraColorCalibration },
  5955. 0x14 => { Name => 'CameraColorCalibration06', %cameraColorCalibration },
  5956. 0x18 => { Name => 'CameraColorCalibration07', %cameraColorCalibration },
  5957. 0x1c => { Name => 'CameraColorCalibration08', %cameraColorCalibration },
  5958. 0x20 => { Name => 'CameraColorCalibration09', %cameraColorCalibration },
  5959. 0x24 => { Name => 'CameraColorCalibration10', %cameraColorCalibration },
  5960. 0x28 => { Name => 'CameraColorCalibration11', %cameraColorCalibration },
  5961. 0x2c => { Name => 'CameraColorCalibration12', %cameraColorCalibration },
  5962. 0x30 => { Name => 'CameraColorCalibration13', %cameraColorCalibration },
  5963. 0x34 => { Name => 'CameraColorCalibration14', %cameraColorCalibration },
  5964. 0x38 => { Name => 'CameraColorCalibration15', %cameraColorCalibration },
  5965. );
  5966. # Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
  5967. %Image::ExifTool::Canon::ColorData5 = (
  5968. %binaryDataAttrs,
  5969. NOTES => 'These tags are used by the PowerShot G10.',
  5970. FORMAT => 'int16s',
  5971. FIRST_ENTRY => 0,
  5972. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  5973. IS_SUBDIR => [ 0x47 ],
  5974. # 0x00 - oddly, this isn't ColorDataVersion (probably should have been version 8)
  5975. 0x47 => {
  5976. Name => 'ColorCoefs',
  5977. Format => 'undef[230]', # ColorTempUnknown13 is last entry
  5978. SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
  5979. },
  5980. 0xba => { Name => 'CameraColorCalibration01', %cameraColorCalibration2,
  5981. Notes => 'B, C, A, D, Temperature' },
  5982. 0xbf => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
  5983. 0xc4 => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
  5984. 0xc9 => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
  5985. 0xce => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
  5986. 0xd3 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
  5987. 0xd8 => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
  5988. 0xdd => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
  5989. 0xe2 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
  5990. 0xe7 => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
  5991. 0xec => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
  5992. 0xf1 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
  5993. 0xf6 => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
  5994. 0xfb => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
  5995. 0x100=> { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
  5996. );
  5997. # Color data (MakerNotes tag 0x4001, count=1273) (ref PH)
  5998. %Image::ExifTool::Canon::ColorData6 = (
  5999. %binaryDataAttrs,
  6000. NOTES => 'These tags are used by the EOS 600D.',
  6001. FORMAT => 'int16s',
  6002. FIRST_ENTRY => 0,
  6003. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6004. IS_SUBDIR => [ 0xbc ],
  6005. 0x00 => {
  6006. Name => 'ColorDataVersion',
  6007. PrintConv => {
  6008. 10 => '10 (600D)',
  6009. },
  6010. },
  6011. 0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
  6012. 0x43 => 'ColorTempAsShot',
  6013. 0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
  6014. 0x48 => 'ColorTempAuto',
  6015. 0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
  6016. 0x4d => 'ColorTempMeasured',
  6017. 0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
  6018. 0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
  6019. 0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
  6020. 0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
  6021. 0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
  6022. 0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
  6023. 0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
  6024. 0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
  6025. 0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
  6026. 0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
  6027. 0x67 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
  6028. 0x6b => 'ColorTempDaylight',
  6029. 0x6c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
  6030. 0x70 => 'ColorTempShade',
  6031. 0x71 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
  6032. 0x75 => 'ColorTempCloudy',
  6033. 0x76 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
  6034. 0x7a => 'ColorTempTungsten',
  6035. 0x7b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
  6036. 0x7f => 'ColorTempFluorescent',
  6037. 0x80 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
  6038. 0x84 => 'ColorTempKelvin',
  6039. 0x85 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
  6040. 0x89 => 'ColorTempFlash',
  6041. 0x8a => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
  6042. 0x8e => { Name => 'ColorTempUnknown6', Unknown => 1 },
  6043. 0x8f => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
  6044. 0x93 => { Name => 'ColorTempUnknown7', Unknown => 1 },
  6045. 0x94 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
  6046. 0x98 => { Name => 'ColorTempUnknown8', Unknown => 1 },
  6047. 0x99 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
  6048. 0x9d => { Name => 'ColorTempUnknown9', Unknown => 1 },
  6049. 0x9e => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
  6050. 0xa2 => { Name => 'ColorTempUnknown10', Unknown => 1 },
  6051. 0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
  6052. 0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
  6053. 0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
  6054. 0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
  6055. 0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
  6056. 0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
  6057. 0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
  6058. 0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
  6059. 0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
  6060. 0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
  6061. 0xbc => {
  6062. Name => 'ColorCalib',
  6063. Format => 'undef[120]',
  6064. Unknown => 1,
  6065. Notes => 'B, C, A, Temperature',
  6066. SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
  6067. },
  6068. 0x194 => { #PH
  6069. Name => 'RawMeasuredRGGB',
  6070. Format => 'int32u[4]',
  6071. Notes => 'raw MeasuredRGGB values, before normalization',
  6072. # swap words because the word ordering is big-endian, opposite to the byte ordering
  6073. ValueConv => \&SwapWords,
  6074. ValueConvInv => \&SwapWords,
  6075. },
  6076. );
  6077. # Unknown color data (MakerNotes tag 0x4001)
  6078. %Image::ExifTool::Canon::ColorDataUnknown = (
  6079. PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
  6080. FORMAT => 'int16s',
  6081. FIRST_ENTRY => 0,
  6082. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6083. );
  6084. # Color information (MakerNotes tag 0x4003) (ref PH)
  6085. %Image::ExifTool::Canon::ColorInfo = (
  6086. %binaryDataAttrs,
  6087. FORMAT => 'int16s',
  6088. FIRST_ENTRY => 1,
  6089. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6090. 1 => {
  6091. Condition => '$$self{Model} =~ /EOS-1D/',
  6092. Name => 'Saturation',
  6093. %Image::ExifTool::Exif::printParameter,
  6094. },
  6095. 2 => {
  6096. Name => 'ColorTone',
  6097. %Image::ExifTool::Exif::printParameter,
  6098. },
  6099. 3 => {
  6100. Name => 'ColorSpace',
  6101. RawConv => '$val ? $val : undef', # ignore tag if zero
  6102. PrintConv => {
  6103. 1 => 'sRGB',
  6104. 2 => 'Adobe RGB',
  6105. },
  6106. },
  6107. );
  6108. # AF micro-adjustment information (MakerNotes tag 0x4013) (ref PH)
  6109. %Image::ExifTool::Canon::AFMicroAdj = (
  6110. %binaryDataAttrs,
  6111. FORMAT => 'int32s',
  6112. FIRST_ENTRY => 1,
  6113. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6114. 1 => {
  6115. Name => 'AFMicroAdjMode',
  6116. PrintConv => {
  6117. 0 => 'Disable',
  6118. 1 => 'Adjust all by the same amount',
  6119. 2 => 'Adjust by lens',
  6120. },
  6121. },
  6122. 2 => {
  6123. Name => 'AFMicroAdjValue',
  6124. Format => 'rational64s',
  6125. },
  6126. );
  6127. # Vignetting correction information (MakerNotes tag 0x4015)
  6128. %Image::ExifTool::Canon::VignettingCorr = (
  6129. %binaryDataAttrs,
  6130. FORMAT => 'int16s',
  6131. FIRST_ENTRY => 1,
  6132. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6133. NOTES => q{
  6134. This information is found in images from the 1DmkIV, 5DmkII, 7D, 50D, 500D
  6135. and 550D.
  6136. },
  6137. # 0 => 'PeripheralLightingVersion', value = 0x1000
  6138. 2 => {
  6139. Name => 'PeripheralLighting',
  6140. PrintConv => { 0 => 'Off', 1 => 'On' },
  6141. },
  6142. 6 => 'PeripheralLightingValue',
  6143. # 10 - flags?
  6144. 11 => {
  6145. Name => 'OriginalImageWidth',
  6146. Notes => 'full size of original image before being rotated or scaled in camera',
  6147. },
  6148. 12 => 'OriginalImageHeight',
  6149. );
  6150. # More Vignetting correction information (MakerNotes tag 0x4016)
  6151. %Image::ExifTool::Canon::VignettingCorr2 = (
  6152. %binaryDataAttrs,
  6153. FORMAT => 'int32s',
  6154. FIRST_ENTRY => 1,
  6155. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6156. 5 => {
  6157. Name => 'PeripheralLightingSetting',
  6158. PrintConv => { 0 => 'Off', 1 => 'On' },
  6159. },
  6160. );
  6161. # Auto Lighting Optimizater information (MakerNotes tag 0x4018) (ref PH)
  6162. %Image::ExifTool::Canon::LightingOpt = (
  6163. %binaryDataAttrs,
  6164. FORMAT => 'int32s',
  6165. FIRST_ENTRY => 1,
  6166. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6167. NOTES => 'This information is new in images from the EOS 7D.',
  6168. 2 => {
  6169. Name => 'AutoLightingOptimizer',
  6170. PrintConv => {
  6171. 0 => 'Standard',
  6172. 1 => 'Low',
  6173. 2 => 'Strong',
  6174. 3 => 'Off',
  6175. },
  6176. },
  6177. );
  6178. # Lens information (MakerNotes tag 0x4019) (ref 20)
  6179. %Image::ExifTool::Canon::LensInfo = (
  6180. %binaryDataAttrs,
  6181. FIRST_ENTRY => 0,
  6182. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6183. 0 => { # this doesn't seem to be valid for some models (ie. 550D, 7D?, 1DmkIV?)
  6184. Name => 'LensSerialNumber',
  6185. Notes => q{
  6186. apparently this is an internal serial number because it doesn't correspond
  6187. to the one printed on the lens
  6188. },
  6189. Condition => '$$valPt !~ /^\0\0\0\0/', # (rules out 550D and older lenses)
  6190. Format => 'undef[5]',
  6191. ValueConv => 'unpack("H*", $val)',
  6192. ValueConvInv => 'pack("H*", $val)',
  6193. },
  6194. );
  6195. # Subject mode ambience information (MakerNotes tag 0x4020) (ref PH)
  6196. %Image::ExifTool::Canon::Ambience = (
  6197. %binaryDataAttrs,
  6198. FORMAT => 'int32s',
  6199. FIRST_ENTRY => 1,
  6200. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6201. 1 => {
  6202. Name => 'AmbienceSelection',
  6203. PrintConv => {
  6204. 0 => 'Standard',
  6205. 1 => 'Vivid',
  6206. 2 => 'Warm',
  6207. 3 => 'Soft',
  6208. 4 => 'Cool',
  6209. 5 => 'Intense',
  6210. 6 => 'Brighter',
  6211. 7 => 'Darker',
  6212. 8 => 'Monochrome',
  6213. },
  6214. },
  6215. );
  6216. # Creative filter information (MakerNotes tag 0x4024) (ref PH)
  6217. %Image::ExifTool::Canon::FilterInfo = (
  6218. PROCESS_PROC => \&ProcessFilters,
  6219. GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
  6220. NOTES => 'Information about creative filter settings.',
  6221. 0x101 => {
  6222. Name => 'GrainyBWFilter',
  6223. Description => 'Grainy B/W Filter',
  6224. PrintConv => '$val == -1 ? "Off" : "On ($val)"',
  6225. PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
  6226. },
  6227. 0x201 => {
  6228. Name => 'SoftFocusFilter',
  6229. PrintConv => '$val == -1 ? "Off" : "On ($val)"',
  6230. PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
  6231. },
  6232. 0x301 => {
  6233. Name => 'ToyCameraFilter',
  6234. PrintConv => '$val == -1 ? "Off" : "On ($val)"',
  6235. PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
  6236. },
  6237. 0x401 => {
  6238. Name => 'MiniatureFilter',
  6239. PrintConv => '$val == -1 ? "Off" : "On ($val)"',
  6240. PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
  6241. },
  6242. 0x0402 => {
  6243. Name => 'MiniatureFilterOrientation',
  6244. PrintConv => {
  6245. 0 => 'Horizontal',
  6246. 1 => 'Vertical',
  6247. },
  6248. },
  6249. 0x403=> 'MiniatureFilterPosition',
  6250. # 0x404 - value: 0, 345, 518, ... (miniature filter width maybe?)
  6251. );
  6252. # Canon CNTH atoms (ref PH)
  6253. %Image::ExifTool::Canon::CNTH = (
  6254. GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
  6255. NOTES => q{
  6256. Canon-specific QuickTime tags found in the CNTH atom of MOV videos from some
  6257. cameras such as the PowerShot S95.
  6258. },
  6259. CNDA => {
  6260. Name => 'ThumbnailImage',
  6261. Format => 'undef',
  6262. Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
  6263. RawConv => q{
  6264. $$self{DOC_NUM} = ++$$self{DOC_COUNT};
  6265. $self->ExtractInfo(\$val, { ReEntry => 1 });
  6266. $$self{DOC_NUM} = 0;
  6267. return \$val;
  6268. },
  6269. },
  6270. );
  6271. # 'skip' atom of Canon MOV videos (ref PH)
  6272. %Image::ExifTool::Canon::Skip = (
  6273. GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
  6274. NOTES => 'Information found in the "skip" atom of Canon MOV videos.',
  6275. CNDB => { Name => 'Unknown_CNDB', Unknown => 1, Binary => 1 },
  6276. );
  6277. # Canon composite tags
  6278. %Image::ExifTool::Canon::Composite = (
  6279. GROUPS => { 2 => 'Camera' },
  6280. DriveMode => {
  6281. Require => {
  6282. 0 => 'ContinuousDrive',
  6283. 1 => 'SelfTimer',
  6284. },
  6285. ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)',
  6286. PrintConv => {
  6287. 0 => 'Continuous Shooting',
  6288. 1 => 'Self-timer Operation',
  6289. 2 => 'Single-frame Shooting',
  6290. },
  6291. },
  6292. Lens => {
  6293. Require => {
  6294. 0 => 'ShortFocal',
  6295. 1 => 'LongFocal',
  6296. },
  6297. ValueConv => '$val[0]',
  6298. PrintConv => 'Image::ExifTool::Canon::PrintFocalRange(@val)',
  6299. },
  6300. Lens35efl => {
  6301. Description => 'Lens',
  6302. Require => {
  6303. 0 => 'ShortFocal',
  6304. 1 => 'LongFocal',
  6305. 3 => 'Lens',
  6306. },
  6307. Desire => {
  6308. 2 => 'ScaleFactor35efl',
  6309. },
  6310. ValueConv => '$val[3] * ($val[2] ? $val[2] : 1)',
  6311. PrintConv => '$prt[3] . ($val[2] ? sprintf(" (35 mm equivalent: %s)",Image::ExifTool::Canon::PrintFocalRange(@val)) : "")',
  6312. },
  6313. ShootingMode => {
  6314. Require => {
  6315. 0 => 'CanonExposureMode',
  6316. 1 => 'EasyMode',
  6317. },
  6318. Desire => {
  6319. 2 => 'BulbDuration',
  6320. },
  6321. # most Canon models set CanonExposureMode to Manual (4) for Bulb shots,
  6322. # but the 1DmkIII uses a value of 7 for Bulb, so use this for other
  6323. # models too (Note that Canon DPP reports "Manual Exposure" here)
  6324. ValueConv => '$val[0] ? (($val[0] eq "4" and $val[2]) ? 7 : $val[0]) : $val[1] + 10',
  6325. PrintConv => '$val eq "7" ? "Bulb" : ($val[0] ? $prt[0] : $prt[1])',
  6326. },
  6327. FlashType => {
  6328. Notes => q{
  6329. may report "Built-in Flash" for some Canon cameras with external flash in
  6330. manual mode
  6331. },
  6332. Require => {
  6333. 0 => 'FlashBits',
  6334. },
  6335. RawConv => '$val[0] ? $val : undef',
  6336. ValueConv => '$val[0]&(1<<14)? 1 : 0',
  6337. PrintConv => {
  6338. 0 => 'Built-In Flash',
  6339. 1 => 'External',
  6340. },
  6341. },
  6342. RedEyeReduction => {
  6343. Require => {
  6344. 0 => 'CanonFlashMode',
  6345. 1 => 'FlashBits',
  6346. },
  6347. RawConv => '$val[1] ? $val : undef',
  6348. ValueConv => '($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0',
  6349. PrintConv => {
  6350. 0 => 'Off',
  6351. 1 => 'On',
  6352. },
  6353. },
  6354. # same as FlashExposureComp, but undefined if no flash
  6355. ConditionalFEC => {
  6356. Description => 'Flash Exposure Compensation',
  6357. Require => {
  6358. 0 => 'FlashExposureComp',
  6359. 1 => 'FlashBits',
  6360. },
  6361. RawConv => '$val[1] ? $val : undef',
  6362. ValueConv => '$val[0]',
  6363. PrintConv => '$prt[0]',
  6364. },
  6365. # hack to assume 1st curtain unless we see otherwise
  6366. ShutterCurtainHack => {
  6367. Description => 'Shutter Curtain Sync',
  6368. Desire => {
  6369. 0 => 'ShutterCurtainSync',
  6370. },
  6371. Require => {
  6372. 1 => 'FlashBits',
  6373. },
  6374. RawConv => '$val[1] ? $val : undef',
  6375. ValueConv => 'defined($val[0]) ? $val[0] : 0',
  6376. PrintConv => {
  6377. 0 => '1st-curtain sync',
  6378. 1 => '2nd-curtain sync',
  6379. },
  6380. },
  6381. WB_RGGBLevels => {
  6382. Require => {
  6383. 0 => 'Canon:WhiteBalance',
  6384. },
  6385. Desire => {
  6386. 1 => 'WB_RGGBLevelsAsShot',
  6387. # indices of the following entries correspond to Canon:WhiteBalance + 2
  6388. 2 => 'WB_RGGBLevelsAuto',
  6389. 3 => 'WB_RGGBLevelsDaylight',
  6390. 4 => 'WB_RGGBLevelsCloudy',
  6391. 5 => 'WB_RGGBLevelsTungsten',
  6392. 6 => 'WB_RGGBLevelsFluorescent',
  6393. 7 => 'WB_RGGBLevelsFlash',
  6394. 8 => 'WB_RGGBLevelsCustom',
  6395. 10 => 'WB_RGGBLevelsShade',
  6396. 11 => 'WB_RGGBLevelsKelvin',
  6397. },
  6398. ValueConv => '$val[1] ? $val[1] : $val[($val[0] || 0) + 2]',
  6399. },
  6400. ISO => {
  6401. Priority => 0, # let EXIF:ISO take priority
  6402. Desire => {
  6403. 0 => 'Canon:CameraISO',
  6404. 1 => 'Canon:BaseISO',
  6405. 2 => 'Canon:AutoISO',
  6406. },
  6407. Notes => 'use CameraISO if numerical, otherwise calculate as BaseISO * AutoISO / 100',
  6408. ValueConv => q{
  6409. return $val[0] if $val[0] and $val[0] =~ /^\d+$/;
  6410. return undef unless $val[1] and $val[2];
  6411. return $val[1] * $val[2] / 100;
  6412. },
  6413. PrintConv => 'sprintf("%.0f",$val)',
  6414. },
  6415. DigitalZoom => {
  6416. Require => {
  6417. 0 => 'Canon:ZoomSourceWidth',
  6418. 1 => 'Canon:ZoomTargetWidth',
  6419. 2 => 'Canon:DigitalZoom',
  6420. },
  6421. RawConv => q{
  6422. ToFloat(@val);
  6423. return undef unless $val[2] and $val[2] == 3 and $val[0] and $val[1];
  6424. return $val[1] / $val[0];
  6425. },
  6426. PrintConv => 'sprintf("%.2fx",$val)',
  6427. },
  6428. OriginalDecisionData => {
  6429. Flags => ['Writable','Protected'],
  6430. WriteGroup => 'MakerNotes',
  6431. Require => 'OriginalDecisionDataOffset',
  6432. RawConv => 'Image::ExifTool::Canon::ReadODD($self,$val[0])',
  6433. },
  6434. FileNumber => {
  6435. Groups => { 2 => 'Image' },
  6436. Writable => 1,
  6437. WriteCheck => '$val=~/\d+-\d+/ ? undef : "Invalid format"',
  6438. DelCheck => '"Can\'t delete"',
  6439. Require => {
  6440. 0 => 'DirectoryIndex',
  6441. 1 => 'FileIndex',
  6442. },
  6443. WriteAlso => {
  6444. DirectoryIndex => '$val=~/(\d+)-(\d+)/; $1',
  6445. FileIndex => '$val=~/(\d+)-(\d+)/; $2',
  6446. },
  6447. ValueConv => 'sprintf("%.3d-%.4d",@val)',
  6448. },
  6449. );
  6450. # add our composite tags
  6451. Image::ExifTool::AddCompositeTags('Image::ExifTool::Canon');
  6452. #------------------------------------------------------------------------------
  6453. # Return lens name with teleconverter if applicable
  6454. # Inputs: 0) lens name string, 1) short focal length
  6455. # Returns: lens string with tc if appropriate
  6456. sub LensWithTC($$)
  6457. {
  6458. my ($lens, $shortFocal) = @_;
  6459. # add teleconverter multiplication factor if applicable
  6460. # (and if the LensType doesn't already include one)
  6461. if (not $lens =~ /x$/ and $lens =~ /(\d+)/) {
  6462. my $sf = $1; # short focal length
  6463. my $tc;
  6464. foreach $tc (1, 1.4, 2, 2.8) {
  6465. next if abs($shortFocal - $sf * $tc) > 0.9;
  6466. $lens .= " + ${tc}x" if $tc > 1;
  6467. last;
  6468. }
  6469. }
  6470. return $lens;
  6471. }
  6472. #------------------------------------------------------------------------------
  6473. # Attempt to identify the specific lens if multiple lenses have the same LensType
  6474. # Inputs: 0) PrintConv hash ref, 1) LensType, 2) ShortFocal, 3) LongFocal
  6475. # 4) MaxAperture, 5) LensModel
  6476. # Notes: PrintConv, LensType, ShortFocal and LongFocal must be defined.
  6477. # Other inputs are optional.
  6478. sub PrintLensID(@)
  6479. {
  6480. my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
  6481. my $lens = $$printConv{$lensType};
  6482. if ($lens) {
  6483. # return this lens unless other lenses have the same LensType
  6484. return LensWithTC($lens, $shortFocal) unless $$printConv{"$lensType.1"};
  6485. $lens =~ s/ or .*//s; # remove everything after "or"
  6486. # make list of all possible matching lenses
  6487. my @lenses = ( $lens );
  6488. my $i;
  6489. for ($i=1; $$printConv{"$lensType.$i"}; ++$i) {
  6490. push @lenses, $$printConv{"$lensType.$i"};
  6491. }
  6492. # look for lens in user-defined lenses
  6493. foreach $lens (@lenses) {
  6494. next unless $Image::ExifTool::userLens{$lens};
  6495. return LensWithTC($lens, $shortFocal);
  6496. }
  6497. # attempt to determine actual lens
  6498. my ($tc, @maybe, @likely, @matches);
  6499. foreach $tc (1, 1.4, 2, 2.8) { # loop through teleconverter scaling factors
  6500. foreach $lens (@lenses) {
  6501. next unless $lens =~ /(\d+)(?:-(\d+))?mm.*?(?:[fF]\/?)(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?/;
  6502. # ($1=short focal, $2=long focal, $3=max aperture wide, $4=max aperture tele)
  6503. my ($sf, $lf, $sa, $la) = ($1, $2, $3, $4);
  6504. # see if we can rule out this lens by focal length or aperture
  6505. $lf = $sf if $sf and not $lf;
  6506. $la = $sa if $sa and not $la;
  6507. next if abs($shortFocal - $sf * $tc) > 0.9;
  6508. my $tclens = $lens;
  6509. $tclens .= " + ${tc}x" if $tc > 1;
  6510. push @maybe, $tclens;
  6511. next if abs($longFocal - $lf * $tc) > 0.9;
  6512. push @likely, $tclens;
  6513. if ($maxAperture) {
  6514. # (not 100% sure that TC affects MaxAperture, but it should!)
  6515. next if $maxAperture < $sa * $tc - 0.15;
  6516. next if $maxAperture > $la * $tc + 0.15;
  6517. }
  6518. push @matches, $tclens;
  6519. }
  6520. last if @maybe;
  6521. }
  6522. return join(' or ', @matches) if @matches;
  6523. return join(' or ', @likely) if @likely;
  6524. return join(' or ', @maybe) if @maybe;
  6525. } elsif ($lensModel and $lensModel =~ /\d/) {
  6526. # use lens model as written by the camera
  6527. if ($printConv eq \%canonLensTypes) {
  6528. # add "Canon" to the start since the Canon cameras only understand Canon lenses
  6529. return "Canon $lensModel";
  6530. } else {
  6531. return $lensModel;
  6532. }
  6533. }
  6534. my $str = '';
  6535. if ($shortFocal) {
  6536. $str .= sprintf(' %d', $shortFocal);
  6537. $str .= sprintf('-%d', $longFocal) if $longFocal and $longFocal != $shortFocal;
  6538. $str .= 'mm';
  6539. }
  6540. return "Unknown$str" if $lensType eq '-1'; # (careful because Sigma LensType's may not be integer)
  6541. return "Unknown ($lensType)$str";
  6542. }
  6543. #------------------------------------------------------------------------------
  6544. # Swap 16-bit words in 32-bit integers
  6545. # Inputs: 0) string of integers
  6546. # Returns: string of word-swapped integers
  6547. sub SwapWords($)
  6548. {
  6549. my @a = split(' ', shift);
  6550. $_ = (($_ >> 16) | ($_ << 16)) & 0xffffffff foreach @a;
  6551. return "@a";
  6552. }
  6553. #------------------------------------------------------------------------------
  6554. # Validate first word of Canon binary data
  6555. # Inputs: 0) data pointer, 1) offset, 2-N) list of valid values
  6556. # Returns: true if data value is the same
  6557. sub Validate($$@)
  6558. {
  6559. my ($dataPt, $offset, @vals) = @_;
  6560. # the first 16-bit value is the length of the data in bytes
  6561. my $dataVal = Image::ExifTool::Get16u($dataPt, $offset);
  6562. my $val;
  6563. foreach $val (@vals) {
  6564. return 1 if $val == $dataVal;
  6565. }
  6566. return undef;
  6567. }
  6568. #------------------------------------------------------------------------------
  6569. # Validate CanonAFInfo
  6570. # Inputs: 0) data pointer, 1) offset, 2) size
  6571. # Returns: true if data appears valid
  6572. sub ValidateAFInfo($$$)
  6573. {
  6574. my ($dataPt, $offset, $size) = @_;
  6575. return 0 if $size < 24; # must be at least 24 bytes long (PowerShot Pro1)
  6576. my $af = Get16u($dataPt, $offset);
  6577. return 0 if $af !~ /^(1|5|7|9|15|45|53)$/; # check NumAFPoints
  6578. my $w1 = Get16u($dataPt, $offset + 4);
  6579. my $h1 = Get16u($dataPt, $offset + 6);
  6580. return 0 unless $h1 and $w1;
  6581. my $f1 = $w1 / $h1;
  6582. # check for normal aspect ratio
  6583. return 1 if abs($f1 - 1.33) < 0.01 or abs($f1 - 1.67) < 0.01;
  6584. # ZoomBrowser can modify this for rotated images (ref Joshua Bixby)
  6585. return 1 if abs($f1 - 0.75) < 0.01 or abs($f1 - 0.60) < 0.01;
  6586. my $w2 = Get16u($dataPt, $offset + 8);
  6587. my $h2 = Get16u($dataPt, $offset + 10);
  6588. return 0 unless $h2 and $w2;
  6589. # compare aspect ratio with AF image size
  6590. # (but the Powershot AFImageHeight is odd, hence the test above)
  6591. return 0 if $w1 eq $h1;
  6592. my $f2 = $w2 / $h2;
  6593. return 1 if abs(1-$f1/$f2) < 0.01;
  6594. return 1 if abs(1-$f1*$f2) < 0.01;
  6595. return 0;
  6596. }
  6597. #------------------------------------------------------------------------------
  6598. # Read original decision data from file (variable length)
  6599. # Inputs: 0) ExifTool object ref, 1) offset in file
  6600. # Returns: reference to original decision data (or undef if no data)
  6601. sub ReadODD($$)
  6602. {
  6603. my ($exifTool, $offset) = @_;
  6604. return undef unless $offset;
  6605. my ($raf, $buff, $buf2, $i, $warn);
  6606. return undef unless defined($raf = $$exifTool{RAF});
  6607. # the data block is a variable length and starts with 0xffffffff
  6608. # followed a 4-byte (int32u) version number
  6609. my $pos = $raf->Tell();
  6610. if ($raf->Seek($offset, 0) and $raf->Read($buff, 8)==8 and $buff=~/^\xff{4}.\0\0/s) {
  6611. my $err = 1;
  6612. # must set byte order in case it is different than current byte order
  6613. # (we could be reading this after byte order was changed)
  6614. my $oldOrder = GetByteOrder();
  6615. my $version = Get32u(\$buff, 4);
  6616. if ($version > 20) {
  6617. ToggleByteOrder();
  6618. $version = unpack('N',pack('V',$version));
  6619. }
  6620. if ($version == 1 or # 1Ds (big endian)
  6621. $version == 2) # 5D/20D (little endian)
  6622. {
  6623. # this data is structured as follows:
  6624. # 4 bytes: all 0xff
  6625. # 4 bytes: version number (=1 or 2)
  6626. # 20 bytes: sha1
  6627. # 4 bytes: record count
  6628. # for each record:
  6629. # | 4 bytes: record number (beginning at 0)
  6630. # | 4 bytes: block offset
  6631. # | 4 bytes: block length
  6632. # | 20 bytes: block sha1
  6633. if ($raf->Read($buf2, 24) == 24) {
  6634. $buff .= $buf2;
  6635. my $count = Get32u(\$buf2, 20);
  6636. # read all records if the count is reasonable
  6637. if ($count and $count < 20 and
  6638. $raf->Read($buf2, $count * 32) == $count * 32)
  6639. {
  6640. $buff .= $buf2;
  6641. undef $err;
  6642. }
  6643. }
  6644. } elsif ($version == 3) { # newer models (little endian)
  6645. # this data is structured as follows:
  6646. # 4 bytes: all 0xff
  6647. # 4 bytes: version number (=3)
  6648. # 24 bytes: sha1 A length (=20) + sha1 A
  6649. # 24 bytes: sha1 B length (=20) + sha1 B
  6650. # 4 bytes: length of remaining data (including this length word!)
  6651. # 8 bytes: salt length (=4) + salt ?
  6652. # 4 bytes: unknown (=3)
  6653. # 4 bytes: size of file
  6654. # 4 bytes: unknown (=1 for most models, 2 for 5DmkII)
  6655. # 4 bytes: unknown (=1)
  6656. # 4 bytes: unknown (always the same for a given firmware version)
  6657. # 4 bytes: unknown (random)
  6658. # 4 bytes: record count
  6659. # for each record:
  6660. # | 4 bytes: record number (beginning at 1)
  6661. # | 8 bytes: salt length (=4) + salt ?
  6662. # | 24 bytes: sha1 length (=20) + sha1
  6663. # | 4 bytes: block count
  6664. # | for each block:
  6665. # | | 4 bytes: block offset
  6666. # | | 4 bytes: block length
  6667. # followed by zero padding to end of ODD data (~72 bytes)
  6668. for ($i=0; ; ++$i) {
  6669. $i == 3 and undef $err, last; # success!
  6670. $raf->Read($buf2, 4) == 4 or last;
  6671. $buff .= $buf2;
  6672. my $len = Get32u(\$buf2, 0);
  6673. # (the data length includes the length word itself - doh!)
  6674. $len -= 4 if $i == 2 and $len >= 4;
  6675. # make sure records are a reasonable size (<= 64kB)
  6676. $len <= 0x10000 and $raf->Read($buf2, $len) == $len or last;
  6677. $buff .= $buf2;
  6678. }
  6679. } else {
  6680. $warn = "Unsupported original decision data version $version";
  6681. }
  6682. SetByteOrder($oldOrder);
  6683. unless ($err) {
  6684. if ($exifTool->Options('HtmlDump')) {
  6685. $exifTool->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
  6686. }
  6687. $raf->Seek($pos, 0); # restore original file position
  6688. return \$buff;
  6689. }
  6690. }
  6691. $exifTool->Warn($warn || 'Invalid original decision data');
  6692. $raf->Seek($pos, 0); # restore original file position
  6693. return undef;
  6694. }
  6695. #------------------------------------------------------------------------------
  6696. # Convert the CameraISO value
  6697. # Inputs: 0) value, 1) set for inverse conversion
  6698. sub CameraISO($;$)
  6699. {
  6700. my ($val, $inv) = @_;
  6701. my $rtnVal;
  6702. my %isoLookup = (
  6703. 0 => 'n/a',
  6704. 14 => 'Auto High', #PH (S3IS)
  6705. 15 => 'Auto',
  6706. 16 => 50,
  6707. 17 => 100,
  6708. 18 => 200,
  6709. 19 => 400,
  6710. 20 => 800, #PH
  6711. );
  6712. if ($inv) {
  6713. $rtnVal = Image::ExifTool::ReverseLookup($val, \%isoLookup);
  6714. if (not defined $rtnVal and Image::ExifTool::IsInt($val)) {
  6715. $rtnVal = ($val & 0x3fff) | 0x4000;
  6716. }
  6717. } elsif ($val != 0x7fff) {
  6718. if ($val & 0x4000) {
  6719. $rtnVal = $val & 0x3fff;
  6720. } else {
  6721. $rtnVal = $isoLookup{$val} || "Unknown ($val)";
  6722. }
  6723. }
  6724. return $rtnVal;
  6725. }
  6726. #------------------------------------------------------------------------------
  6727. # Print range of focal lengths
  6728. # Inputs: 0) short focal, 1) long focal, 2) optional scaling factor
  6729. sub PrintFocalRange(@)
  6730. {
  6731. my ($short, $long, $scale) = @_;
  6732. $scale or $scale = 1;
  6733. if ($short == $long) {
  6734. return sprintf("%.1f mm", $short * $scale);
  6735. } else {
  6736. return sprintf("%.1f - %.1f mm", $short * $scale, $long * $scale);
  6737. }
  6738. }
  6739. #------------------------------------------------------------------------------
  6740. # Process a serial stream of binary data
  6741. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  6742. # Returns: 1 on success
  6743. # Notes: The tagID's for serial stream tags are consecutive indices beginning
  6744. # at 0, and the corresponding values must be contiguous in memory.
  6745. # "Unknown" tags must be used to skip padding or unknown values.
  6746. sub ProcessSerialData($$$)
  6747. {
  6748. my ($exifTool, $dirInfo, $tagTablePtr) = @_;
  6749. my $dataPt = $$dirInfo{DataPt};
  6750. my $offset = $$dirInfo{DirStart};
  6751. my $size = $$dirInfo{DirLen};
  6752. my $base = $$dirInfo{Base} || 0;
  6753. my $verbose = $exifTool->Options('Verbose');
  6754. my $dataPos = $$dirInfo{DataPos} || 0;
  6755. # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
  6756. # (require to maintain serial data synchronization)
  6757. my $unknown = $exifTool->Options(Unknown => 1);
  6758. # but disable unknown tag generation (because processing ends when we run out of tags)
  6759. $$exifTool{NO_UNKNOWN} = 1;
  6760. $verbose and $exifTool->VerboseDir('SerialData', undef, $size);
  6761. # get default format ('int8u' unless specified)
  6762. my $defaultFormat = $$tagTablePtr{FORMAT} || 'int8u';
  6763. my ($index, %val);
  6764. my $pos = 0;
  6765. for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
  6766. my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $index) or last;
  6767. my $format = $$tagInfo{Format};
  6768. my $count = 1;
  6769. if ($format) {
  6770. if ($format =~ /(.*)\[(.*)\]/) {
  6771. $format = $1;
  6772. $count = $2;
  6773. # evaluate count to allow count to be based on previous values
  6774. #### eval Format (%val, $size)
  6775. $count = eval $count;
  6776. $@ and warn("Format $$tagInfo{Name}: $@"), last;
  6777. } elsif ($format eq 'string') {
  6778. # allow string with no specified count to run to end of block
  6779. $count = ($size > $pos) ? $size - $pos : 0;
  6780. }
  6781. } else {
  6782. $format = $defaultFormat;
  6783. }
  6784. my $len = (Image::ExifTool::FormatSize($format) || 1) * $count;
  6785. last if $pos + $len > $size;
  6786. my $val = ReadValue($dataPt, $pos+$offset, $format, $count, $size-$pos);
  6787. last unless defined $val;
  6788. if ($verbose) {
  6789. $exifTool->VerboseInfo($index, $tagInfo,
  6790. Index => $index,
  6791. Table => $tagTablePtr,
  6792. Value => $val,
  6793. DataPt => $dataPt,
  6794. Size => $len,
  6795. Start => $pos+$offset,
  6796. Addr => $pos+$offset+$base+$dataPos,
  6797. Format => $format,
  6798. Count => $count,
  6799. );
  6800. }
  6801. $val{$index} = $val;
  6802. if ($$tagInfo{SubDirectory}) {
  6803. my $subTablePtr = GetTagTable($tagInfo->{SubDirectory}->{TagTable});
  6804. my %dirInfo = (
  6805. DataPt => \$val,
  6806. DataPos => $dataPos + $pos,
  6807. DirStart => 0,
  6808. DirLen => length($val),
  6809. );
  6810. $exifTool->ProcessDirectory(\%dirInfo, $subTablePtr);
  6811. } elsif (not $$tagInfo{Unknown} or $unknown) {
  6812. # don't extract zero-length information
  6813. $exifTool->FoundTag($tagInfo, $val) if $count;
  6814. }
  6815. $pos += $len;
  6816. }
  6817. $exifTool->Options(Unknown => $unknown); # restore Unknown option
  6818. delete $$exifTool{NO_UNKNOWN};
  6819. return 1;
  6820. }
  6821. #------------------------------------------------------------------------------
  6822. # Print 1D AF points
  6823. # Inputs: 0) value to convert
  6824. # Focus point pattern:
  6825. # A1 A2 A3 A4 A5 A6 A7
  6826. # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
  6827. # C1 C2 C3 C4 C5 C6 C7 C9 C9 C10 C11
  6828. # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
  6829. # E1 E2 E3 E4 E5 E6 E7
  6830. sub PrintAFPoints1D($)
  6831. {
  6832. my $val = shift;
  6833. return 'Unknown' unless length $val == 8;
  6834. # list of focus point values for decoding the first byte of the 8-byte record.
  6835. # they are the x/y positions of each bit in the AF point mask
  6836. # (y is upper 3 bits / x is lower 5 bits)
  6837. my @focusPts = (0,0,
  6838. 0x04,0x06,0x08,0x0a,0x0c,0x0e,0x10, 0,0,
  6839. 0x21,0x23,0x25,0x27,0x29,0x2b,0x2d,0x2f,0x31,0x33,
  6840. 0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4d,0x50,0x52,0x54,
  6841. 0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73, 0,0,
  6842. 0x84,0x86,0x88,0x8a,0x8c,0x8e,0x90, 0,0,0,0,0
  6843. );
  6844. my $focus = unpack('C',$val);
  6845. my @bits = split //, unpack('b*',substr($val,1));
  6846. my @rows = split //, ' AAAAAAA BBBBBBBBBBCCCCCCCCCCCDDDDDDDDDD EEEEEEE ';
  6847. my ($focusing, $focusPt, @points);
  6848. my $lastRow = '';
  6849. my $col = 0;
  6850. foreach $focusPt (@focusPts) {
  6851. my $row = shift @rows;
  6852. $col = ($row eq $lastRow) ? $col + 1 : 1;
  6853. $lastRow = $row;
  6854. $focusing = "$row$col" if $focus eq $focusPt;
  6855. push @points, "$row$col" if shift @bits;
  6856. }
  6857. $focusing or $focusing = ($focus eq 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
  6858. return "$focusing (" . join(',',@points) . ')';
  6859. }
  6860. #------------------------------------------------------------------------------
  6861. # Convert Canon hex-based EV (modulo 0x20) to real number
  6862. # Inputs: 0) value to convert
  6863. # ie) 0x00 -> 0
  6864. # 0x0c -> 0.33333
  6865. # 0x10 -> 0.5
  6866. # 0x14 -> 0.66666
  6867. # 0x20 -> 1 ... etc
  6868. sub CanonEv($)
  6869. {
  6870. my $val = shift;
  6871. my $sign;
  6872. # temporarily make the number positive
  6873. if ($val < 0) {
  6874. $val = -$val;
  6875. $sign = -1;
  6876. } else {
  6877. $sign = 1;
  6878. }
  6879. my $frac = $val & 0x1f;
  6880. $val -= $frac; # remove fraction
  6881. # Convert 1/3 and 2/3 codes
  6882. if ($frac == 0x0c) {
  6883. $frac = 0x20 / 3;
  6884. } elsif ($frac == 0x14) {
  6885. $frac = 0x40 / 3;
  6886. }
  6887. return $sign * ($val + $frac) / 0x20;
  6888. }
  6889. #------------------------------------------------------------------------------
  6890. # Convert number to Canon hex-based EV (modulo 0x20)
  6891. # Inputs: 0) number
  6892. # Returns: Canon EV code
  6893. sub CanonEvInv($)
  6894. {
  6895. my $num = shift;
  6896. my $sign;
  6897. # temporarily make the number positive
  6898. if ($num < 0) {
  6899. $num = -$num;
  6900. $sign = -1;
  6901. } else {
  6902. $sign = 1;
  6903. }
  6904. my $val = int($num);
  6905. my $frac = $num - $val;
  6906. if (abs($frac - 0.33) < 0.05) {
  6907. $frac = 0x0c
  6908. } elsif (abs($frac - 0.67) < 0.05) {
  6909. $frac = 0x14;
  6910. } else {
  6911. $frac = int($frac * 0x20 + 0.5);
  6912. }
  6913. return $sign * ($val * 0x20 + $frac);
  6914. }
  6915. #------------------------------------------------------------------------------
  6916. # Process a creative filter data
  6917. # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
  6918. # Returns: 1 on success
  6919. sub ProcessFilters($$$)
  6920. {
  6921. my ($exifTool, $dirInfo, $tagTablePtr) = @_;
  6922. my $dataPt = $$dirInfo{DataPt};
  6923. my $pos = $$dirInfo{DirStart};
  6924. my $dirLen = $$dirInfo{DirLen};
  6925. my $dataPos = $$dirInfo{DataPos} || 0;
  6926. my $end = $pos + $dirLen;
  6927. my $verbose = $exifTool->Options('Verbose');
  6928. return 0 if $dirLen < 8;
  6929. my $numFilters = Get32u($dataPt, $pos + 4);
  6930. $verbose and $exifTool->VerboseDir('Creative Filter', $numFilters);
  6931. $pos += 8;
  6932. my ($i, $j, $err);
  6933. for ($i=0; $i<$numFilters; ++$i) {
  6934. # read filter structure:
  6935. # 4 bytes - filter number
  6936. # 4 bytes - filter data length
  6937. # 4 bytes - number of parameters:
  6938. # | 4 bytes - paramter ID
  6939. # | 4 bytes - paramter value count
  6940. # | 4 bytes * count - paramter values (NC)
  6941. $pos + 12 > $end and $err = "Truncated data for filter $i", last;
  6942. my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
  6943. my $size = Get32u($dataPt, $pos + 4);
  6944. my $nparm = Get32u($dataPt, $pos + 8);
  6945. my $nxt = $pos + 4 + $size;
  6946. $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
  6947. $verbose and $exifTool->VerboseDir("Filter $fnum", $nparm, $size);
  6948. $pos += 12;
  6949. for ($j=0; $j<$nparm; ++$j) {
  6950. $pos + 12 > $end and $err = "Truncated data for filter $i param $j", last;
  6951. my $tag = Get32u($dataPt, $pos);
  6952. my $count = Get32u($dataPt, $pos + 4);
  6953. $pos += 8;
  6954. $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
  6955. my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
  6956. $exifTool->HandleTag($tagTablePtr, $tag, $val,
  6957. DataPt => $dataPt,
  6958. DataPos => $dataPos,
  6959. Start => $pos,
  6960. Size => 4 * $count,
  6961. );
  6962. $pos += 4 * $count;
  6963. }
  6964. $pos = $nxt; # step to next filter
  6965. }
  6966. $err and $exifTool->Warn($err, 1);
  6967. return 1;
  6968. }
  6969. #------------------------------------------------------------------------------
  6970. # Write Canon maker notes
  6971. # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
  6972. # Returns: data block (may be empty if no Exif data) or undef on error
  6973. sub WriteCanon($$$)
  6974. {
  6975. my ($exifTool, $dirInfo, $tagTablePtr) = @_;
  6976. $exifTool or return 1; # allow dummy access to autoload this package
  6977. my $dirData = Image::ExifTool::Exif::WriteExif($exifTool, $dirInfo, $tagTablePtr);
  6978. # add footer which is written by some Canon models (format of a TIFF header)
  6979. if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
  6980. $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
  6981. $dirInfo->{Fixup}->AddFixup(length($dirData) - 4);
  6982. }
  6983. return $dirData;
  6984. }
  6985. #------------------------------------------------------------------------------
  6986. 1; # end
  6987. __END__
  6988. =head1 NAME
  6989. Image::ExifTool::Canon - Canon EXIF maker notes tags
  6990. =head1 SYNOPSIS
  6991. This module is loaded automatically by Image::ExifTool when required.
  6992. =head1 DESCRIPTION
  6993. This module contains definitions required by Image::ExifTool to interpret
  6994. Canon maker notes in EXIF information.
  6995. =head1 AUTHOR
  6996. Copyright 2003-2012, Phil Harvey (phil at owl.phy.queensu.ca)
  6997. This library is free software; you can redistribute it and/or modify it
  6998. under the same terms as Perl itself.
  6999. =head1 REFERENCES
  7000. =over 4
  7001. =item L<http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html>
  7002. =item L<http://www.wonderland.org/crw/>
  7003. =item L<http://www.cybercom.net/~dcoffin/dcraw/>
  7004. =item L<http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm>
  7005. =item (...plus lots of testing with my 300D and my daughter's A570IS!)
  7006. =back
  7007. =head1 ACKNOWLEDGEMENTS
  7008. Thanks Michael Rommel and Daniel Pittman for information they provided about
  7009. the Digital Ixus and PowerShot S70 cameras, Juha Eskelinen and Emil Sit for
  7010. figuring out the 20D and 30D FileNumber, Denny Priebe for figuring out a
  7011. couple of 1D tags, and Michael Tiemann, Rainer Honle, Dave Nicholson, Chris
  7012. Huebsch, Ger Vermeulen, Darryl Zurn, D.J. Cristi, Bogdan and Vesa Kivisto for
  7013. decoding a number of new tags. Also thanks to everyone who made contributions
  7014. to the LensType lookup list or the meanings of other tag values.
  7015. =head1 SEE ALSO
  7016. L<Image::ExifTool::TagNames/Canon Tags>,
  7017. L<Image::ExifTool(3pm)|Image::ExifTool>
  7018. =cut