Overview
| Artifact ID: | d7aeae88f6ac44a0b31e26e80aaacc898dbc8391 |
|---|---|
| Ticket: | 1161942fffffffffffffffffffffffffffffffff |
| Date: | 2005-03-12 19:46:24 |
| User: | nobody |
| Artifact Attached: | fdd04111f92c89d100e0d0593ae83193ab03067f |
| Filename: | exif-patch.txt |
| Description: | EXIF-2.2 tags for exif.tcl |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 26148c48 < package provide exif 1.1.2 ; # first release --- > package provide exif 1.2 ; # first release 53a54 > variable cameraMake ; # used internally to understand options 134a136 > variable cameraMake 168a171 > set cameraMake $value 220a224 > variable cameraMake 237c241,243 < array set result [makerNote $data $offset] --- > #ML > # Catch error if vendor specific makerNote is not available or fails > catch {array set result [makerNote_[string toupper [string range $cameraMake 0 3]] $data $offset]} 239,241c245,261 < # Apparently, this doesn't usually work. < set result(UserComment) "$offset - [string range $data $offset [expr {$offset+8}]]" < set result(UserComment) [string trim $result(UserComment) "\0"] --- > #ML > # The first 8Bytes specify the type. If all zero the type is undefined. > set type [string range $data $offset [expr {$offset + 7}]] > set type [string trim $type "\0"] > debug "UserComment type: '$type'" > set result(UserComment) "" > if {$type != ""} { > set value [string range $data [expr {$offset + 8}] [expr {$offset + 8 + $components - 1}]] > set value [string trim $value] > # normal string trim does not seem to work right here > for {set i 0} {$i < [string length $value]} {incr i 1} { > set a [string index $value $i] > if {![string is print $a]} { break } > append result(UserComment) $a > } > } > set result(UserComment) [string trim $result(UserComment)] 252c272 < set value [readIFDEntry $data $format $components $offset] --- > set value [readIFDEntry $data $format $components $offset] 256c276 < set result(ExposureTime) "$value seconds" --- > set result(ExposureTime) "$value s" 258c278 < set result(ExposureTime) "1/[expr {1.0/$value}] seconds" --- > set result(ExposureTime) "1/[format %.0f [expr {1.0/$value}]] s" 261a282,295 > } elseif {$tag == 0x8822} { > #ML > set result(ExposureProgram) [switch $value { > 0 {format "not defined"} > 1 {format "manual"} > 2 {format "normal program"} > 3 {format "aperture priority"} > 4 {format "shutter priority"} > 5 {format "creative program"} > 6 {format "action program"} > 7 {format "portrait mode"} > 8 {format "landscape mode"} > default {format unknown} > }] 309a344,368 > } elseif {$tag == 0x9208} { > #ML > set result(LightSource) [switch $value { > 1 {format "daylight"} > 2 {format "fluorescent"} > 3 {format "tungsten"} > 4 {format "flash"} > 9 {format "fine weather"} > 10 {format "cloudy weather"} > 11 {format "shade"} > 12 {format "daylight fluorescent"} > 13 {format "day white fluorescent"} > 14 {format "cool white fluorescent"} > 15 {format "white fluorescent"} > 17 {format "standard light A"} > 18 {format "standard light B"} > 19 {format "standard light C"} > 20 {format "D55"} > 21 {format "D65"} > 22 {format "D75"} > 23 {format "D50"} > 24 {format "ISO studio tungsten"} > 255 {format "other light source"} > default {format unknown} > }] 335a395,397 > } elseif {$tag == 0xA215} { > #ML > set result(ExposureIndex) $value 337,338c399,412 < # 2 = 1 chip color area sensor < set result(SensingMethod) $value --- > #ML > set result(SensingMethod) [switch $value { > 1 {format "not defined"} > 2 {format "one-chip color area sensor"} > 3 {format "two-chip color area sensor"} > 4 {format "three-chip color area sensor"} > 5 {format "color sequential area sensor"} > 7 {format "trilinear sensor"} > 7 {format "color sequential linear sensor"} > default {format unknown} > }] > } elseif {$tag == 0xA301} { > #ML > set result(SceneType) "directly photographed image" 369a444,475 > } elseif {$tag == 0xA408} { > #ML > set result(Contrast) [switch $value { > 0 {format "normal"} > 1 {format "soft"} > 2 {format "hard"} > default {format unknown} > }] > } elseif {$tag == 0xA409} { > #ML > set result(Saturation) [switch $value { > 0 {format "normal"} > 1 {format "low saturation"} > 2 {format "high saturation"} > default {format unknown} > }] > } elseif {$tag == 0xA40A} { > #ML > set result(Sharpness) [switch $value { > 0 {format "normal"} > 1 {format "soft"} > 2 {format "hard"} > default {format unknown} > }] > } elseif {$tag == 0xA40C} { > #ML > set result(SubjectDistanceRange) [switch $value { > 1 {format "macro"} > 2 {format "close view"} > 3 {format "distant view"} > default {format unknown} > }] 395c501,503 < error "Unrecognized EXIF Tag: $tag (0x[string toupper [format %x $tag]])" --- > #ML > debug "Unrecognized EXIF Tag: $tag (0x[format %X $tag])" > lappend result(UnrcognizedTags) "0x[format %X $tag]" 401a510,574 > #ML > # makerNote for OLYMPUS cameras > proc ::exif::makerNote_OLYM {data curoffset} { > variable cameraModel > debug "MakerNote_OLYM: offset=$curoffset" > array set result {} > > set value [readIFDEntry $data 2 5 $curoffset] > if {$value == "OLYMP"} { > incr curoffset 8 > } > set numEntries [readShort $data $curoffset] > debug "Number of directory entries: $numEntries" > incr curoffset 2 > for {set i 0} {$i < $numEntries} {incr i} { > set head [expr {$curoffset + 12 * $i}] > set entry [string range $data $head [expr {$head+11}]] > set tag [readShort $entry 0] > set format [readShort $entry 2] > set components [readLong $entry 4] > set offset [readLong $entry 8] > set value [readIFDEntry $data $format $components $offset] > debug "$i)\tTag: 0x[string toupper [format %x $tag]]" > > if {$tag == 0x0200} { > set value [readLong $data [expr {$offset + 0}]] > set result(OlympusShootingMode) [switch $value { > 0 {format "single"} > 2 {format "sequential"} > 3 {format "panoramic"} > default {format unknown} > }] > > set value [readLong $data [expr {$offset + 4}]] > set result(OlympusSequenceNumber) $value > > set value [readLong $data [expr {$offset + 8}]] > set result(OlympusPanoramicDirection) $value > > } elseif {$tag == 0x0201} { > set result(OlympusImageQuality) [switch $value { > 1 {format "SQ"} > 2 {format "HQ"} > 3 {format "SHQ"} > default {format unknown} > }] > } elseif {$tag == 0x0202} { > set result(OlympusMacroMode) [switch $value { > 0 {format "normal"} > 1 {format "macro"} > default {format unknown} > }] > } elseif {$tag == 0x0204} { > set result(OlympusDigitalZoomRatio) $value > } elseif {$tag == 0x0207} { > set result(OlympusFirmwareVersion) $value > } elseif {$tag == 0x0208} { > set result(OlympusPictureInfo) $value > } elseif {$tag == 0x0209} { > set result(OlympusCameraID) $value > } > } > return [array get result] > } > 403c576 < proc ::exif::makerNote {data curoffset} { --- > proc ::exif::makerNote_CANO {data curoffset} { 405c578 < debug "MakerNote: offset=$curoffset" --- > debug "MakerNote_CANO: offset=$curoffset" 789c962 < return $offset --- > return $offset 795c968,980 < return [expr {(1.0*$numerator)/$denominator}] --- > #ML This should not happen > if {$denominator == 0} {return 0} > return [expr {(1.0*$numerator)/$denominator}] > } elseif {$format == 7} { > #ML > # undefined 8Bit > set value "" > if {$components < 4} { > set value [string range $offset 0 [expr {$components - 1}]] > } else { > set value [string range $data $offset [expr {$offset + $components - 1}]] > } > return $value 800a986,987 > #ML This should not happen > if {$denominator == 0} {return 0} 804c991,993 < error "Invalid IFD entry format: $x" --- > #ML Return empty string is better than raising an error > debug "Invalid IFD entry format: $x" > return "" 851c1040 < foreach proc {analyze app1 exifSubIFD makerNote} { --- > foreach proc {analyze app1 exifSubIFD makerNote_CANO makerNote_OLYM} {
