- Timestamp:
- 2011-06-01T12:33:42+12:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Ricoh.pm
r16842 r24107 17 17 use Image::ExifTool::Exif; 18 18 19 $VERSION = '1. 05';19 $VERSION = '1.17'; 20 20 21 21 sub ProcessRicohText($$$); 22 22 sub ProcessRicohRMETA($$$); 23 24 # lens types for Ricoh GXR 25 my %ricohLensIDs = ( 26 Notes => q{ 27 Lens units available for the GXR, used by the Ricoh Composite LensID tag. Note 28 that unlike lenses for all other makes of cameras, the focal lengths in these 29 model names have already been scaled to include the 35mm crop factor. 30 }, 31 # (the exact lens model names used by Ricoh, except for a change in case) 32 'RL1' => 'GR Lens A12 50mm F2.5 Macro', 33 'RL2' => 'Ricoh Lens S10 24-70mm F2.5-4.4 VC', 34 'RL3' => 'Ricoh Lens P10 28-300mm F3.5-5.6 VC', 35 'RL5' => 'GR Lens A12 28mm F2.5', 36 ); 23 37 24 38 %Image::ExifTool::Ricoh::Main = ( … … 27 41 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif, 28 42 WRITABLE => 1, 29 NOTES => 'These tags are used by Ricoh Caplio camera models.', 30 0x0001 => { Name => 'MakerNoteType', Writable => 'string' }, 31 0x0002 => { Name => 'MakerNoteVersion', Writable => 'string' }, 43 0x0001 => { Name => 'MakerNoteType', Writable => 'string' }, 44 0x0002 => { #PH 45 Name => 'FirmwareVersion', 46 Writable => 'string', 47 # ie. "Rev0113" is firmware version 1.13 48 PrintConv => '$val=~/^Rev(\d+)$/ ? sprintf("%.2f",$1/100) : $val', 49 PrintConvInv => '$val=~/^(\d+)\.(\d+)$/ ? sprintf("Rev%.2d%.2d",$1,$2) : $val', 50 }, 51 0x0005 => [ #PH 52 { 53 Condition => '$$valPt =~ /^[-\w ]+$/', 54 Name => 'SerialNumber', # (verified for GXR) 55 Writable => 'undef', 56 Count => 16, 57 Notes => q{ 58 the serial number stamped on the camera begins with 2 model-specific letters 59 followed by the last 8 digits of this value. For the GXR, this is the 60 serial number of the lens unit 61 }, 62 PrintConv => '$val=~s/^(.*)(.{8})$/($1)$2/; $val', 63 PrintConvInv => '$val=~tr/()//d; $val', 64 },{ 65 Name => 'InternalSerialNumber', 66 Writable => 'undef', 67 Count => 16, 68 PrintConv => 'unpack("H*", $val)', 69 PrintConvInv => 'pack("H*", $val)', 70 }, 71 ], 32 72 0x0e00 => { 33 73 Name => 'PrintIM', 34 74 Writable => 0, 35 75 Description => 'Print Image Matching', 36 SubDirectory => { 37 TagTable => 'Image::ExifTool::PrintIM::Main', 38 }, 76 SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main' }, 39 77 }, 40 78 0x1001 => { 41 79 Name => 'ImageInfo', 42 SubDirectory => { 43 TagTable => 'Image::ExifTool::Ricoh::ImageInfo', 44 }, 80 SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::ImageInfo' }, 45 81 }, 46 82 0x1003 => { … … 56 92 { 57 93 Name => 'RicohSubdir', 58 Condition => '$self->{ CameraModel} !~ /^Caplio RR1\b/',94 Condition => '$self->{Model} !~ /^Caplio RR1\b/', 59 95 SubDirectory => { 60 96 Validate => '$val =~ /^\[Ricoh Camera Info\]/', … … 119 155 DataTag => 'PreviewImage', 120 156 Protected => 2, 157 # prevent preview from being written to raw images 158 RawConvInv => q{ 159 return $val if $$self{FILE_TYPE} eq "JPEG"; 160 warn "Can't write PreviewImage to $$self{TIFF_TYPE} file\n"; 161 return undef; 162 }, 121 163 }, 122 164 30 => { … … 126 168 DataTag => 'PreviewImage', 127 169 Protected => 2, 170 RawConvInv => q{ 171 return $val if $$self{FILE_TYPE} eq "JPEG"; 172 warn "\n"; # suppress warning (already issued for PreviewImageStart) 173 return undef; 174 }, 128 175 }, 129 176 32 => { … … 155 202 3 => 'Tungsten', 156 203 4 => 'Fluorescent', 157 # 5 (One Pushes, flake setting?) 158 # 7 (details setting?) 204 5 => 'Manual', #PH (GXR) 205 7 => 'Detail', 206 9 => 'Multi-pattern Auto', #PH (GXR) 159 207 }, 160 208 }, … … 169 217 7 => 800, 170 218 8 => 1600, 219 9 => 'Auto', #PH (? CX3) 171 220 }, 172 221 }, … … 177 226 1 => 'Normal', 178 227 2 => 'Low', 179 3 => 'None (B&W)', 180 }, 181 }, 182 ); 183 228 3 => 'B&W', 229 6 => 'Toning Effect', #PH (GXR Sepia,Red,Green,Blue,Purple) 230 9 => 'Vivid', #PH (GXR) 231 10 => 'Natural', #PH (GXR) 232 }, 233 }, 234 ); 235 236 # Ricoh subdirectory tags (ref PH) 184 237 # NOTE: this subdir is not currently writable because the offsets would require 185 238 # special code to handle the funny start location and base offset … … 188 241 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif, 189 242 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif, 190 0x0004 => { Name => 'RicohDateTime1', Groups => { 2 => 'Time' } }, #PH 191 0x0005 => { Name => 'RicohDateTime2', Groups => { 2 => 'Time' } }, #PH 192 # 0x000E ProductionNumber? (ref 2) 243 # the significance of the following 2 dates is not known. They are usually 244 # within a month of each other, but I have seen differences of nearly a year. 245 # Sometimes the first is more recent, and sometimes the second. 246 0x0004 => { # (NC) 247 Name => 'ManufactureDate1', 248 Groups => { 2 => 'Time' }, 249 Writable => 'string', 250 Count => 20, 251 }, 252 0x0005 => { # (NC) 253 Name => 'ManufactureDate2', 254 Groups => { 2 => 'Time' }, 255 Writable => 'string', 256 Count => 20, 257 }, 258 # 0x000c - int32u[2] 1st number is a counter (file number? shutter count?) - PH 259 # 0x0014 - int8u[338] - could contain some data related to face detection? - PH 260 # 0x0015 - int8u[2]: related to noise reduction? 261 0x001a => { #PH 262 Name => 'FaceInfo', 263 SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::FaceInfo' }, 264 }, 265 0x0029 => { 266 Name => 'FirmwareInfo', 267 SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::FirmwareInfo' }, 268 }, 269 0x002a => { 270 Name => 'NoiseReduction', 271 # this is the applied value if NR is set to "Auto" 272 Writable => 'int32u', 273 PrintConv => { 274 0 => 'Off', 275 1 => 'Weak', 276 2 => 'Strong', 277 3 => 'Max', 278 }, 279 }, 280 0x002c => { # (GXR) 281 Name => 'SerialInfo', 282 SubDirectory => { TagTable => 'Image::ExifTool::Ricoh::SerialInfo' }, 283 } 284 # 0x000E ProductionNumber? (ref 2) [no. zero for most models - PH] 285 ); 286 287 # face detection information (ref PH, CX4) 288 %Image::ExifTool::Ricoh::FaceInfo = ( 289 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, 290 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, 291 WRITE_PROC => \&Image::ExifTool::WriteBinaryData, 292 CHECK_PROC => \&Image::ExifTool::CheckBinaryData, 293 WRITABLE => 1, 294 FIRST_ENTRY => 0, 295 DATAMEMBER => [ 181 ], 296 0xb5 => { # (should be int16u at 0xb4?) 297 Name => 'FacesDetected', 298 DataMember => 'FacesDetected', 299 RawConv => '$$self{FacesDetected} = $val', 300 }, 301 0xb6 => { 302 Name => 'FaceDetectFrameSize', 303 Format => 'int16u[2]', 304 }, 305 0xbc => { 306 Name => 'Face1Position', 307 Condition => '$$self{FacesDetected} >= 1', 308 Format => 'int16u[4]', 309 Notes => q{ 310 left, top, width and height of detected face in coordinates of 311 FaceDetectFrameSize with increasing Y downwards 312 }, 313 }, 314 0xc8 => { 315 Name => 'Face2Position', 316 Condition => '$$self{FacesDetected} >= 2', 317 Format => 'int16u[4]', 318 }, 319 0xd4 => { 320 Name => 'Face3Position', 321 Condition => '$$self{FacesDetected} >= 3', 322 Format => 'int16u[4]', 323 }, 324 0xe0 => { 325 Name => 'Face4Position', 326 Condition => '$$self{FacesDetected} >= 4', 327 Format => 'int16u[4]', 328 }, 329 0xec => { 330 Name => 'Face5Position', 331 Condition => '$$self{FacesDetected} >= 5', 332 Format => 'int16u[4]', 333 }, 334 0xf8 => { 335 Name => 'Face6Position', 336 Condition => '$$self{FacesDetected} >= 6', 337 Format => 'int16u[4]', 338 }, 339 0x104 => { 340 Name => 'Face7Position', 341 Condition => '$$self{FacesDetected} >= 7', 342 Format => 'int16u[4]', 343 }, 344 0x110 => { 345 Name => 'Face8Position', 346 Condition => '$$self{FacesDetected} >= 8', 347 Format => 'int16u[4]', 348 }, 349 ); 350 351 # firmware version information (ref PH) 352 %Image::ExifTool::Ricoh::FirmwareInfo = ( 353 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, 354 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, 355 WRITE_PROC => \&Image::ExifTool::WriteBinaryData, 356 CHECK_PROC => \&Image::ExifTool::CheckBinaryData, 357 WRITABLE => 1, 358 0x00 => { 359 Name => 'FirmwareRevision', 360 Format => 'string[12]', 361 }, 362 0x0c => { 363 Name => 'FirmwareRevision2', 364 Format => 'string[12]', 365 }, 366 ); 367 368 # serial/version number information written by GXR (ref PH) 369 %Image::ExifTool::Ricoh::SerialInfo = ( 370 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, 371 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, 372 WRITE_PROC => \&Image::ExifTool::WriteBinaryData, 373 CHECK_PROC => \&Image::ExifTool::CheckBinaryData, 374 WRITABLE => 1, 375 NOTES => 'This information is found in images from the GXR.', 376 0 => { 377 Name => 'BodyFirmware', #(NC) 378 Format => 'string[16]', 379 # observed: "RS1 :V00560000" --> FirmwareVersion "Rev0056" 380 # "RS1 :V01020200" --> FirmwareVersion "Rev0102" 381 }, 382 16 => { 383 Name => 'BodySerialNumber', 384 Format => 'string[16]', 385 # observed: "SID:00100056" --> "WD00100056" on plate 386 }, 387 32 => { 388 Name => 'LensFirmware', #(NC) 389 Format => 'string[16]', 390 # observed: "RL1 :V00560000", "RL1 :V01020200" - A12 50mm F2.5 Macro 391 # "RL2 :V00560000", "RL2 :V01020300" - S10 24-70mm F2.5-4.4 VC 392 # --> used in a Composite tag to determine LensType 393 }, 394 48 => { 395 Name => 'LensSerialNumber', 396 Format => 'string[16]', 397 # observed: (S10) "LID:00010024" --> "WF00010024" on plate 398 # (A12) "LID:00010054" --> "WE00010029" on plate?? 399 }, 193 400 ); 194 401 … … 198 405 PROCESS_PROC => \&ProcessRicohText, 199 406 NOTES => q{ 200 Ricoh RDC models such as the RDC-i700, RDC-5000, RDC-6000, RDC-7 and 201 RDC-4300 use a text-based format for their maker notes instead of the IFD 202 format used by the Caplio models. Below is a list of known tags in this 203 information. 204 }, 205 Rev => 'Revision', 206 Rv => 'Revision', 407 Some Ricoh DC and RDC models use a text-based format for their maker notes 408 instead of the IFD format used by the Caplio models. Below is a list of known 409 tags in this information. 410 }, 411 Rev => { 412 Name => 'FirmwareVersion', 413 PrintConv => '$val=~/^\d+$/ ? sprintf("%.2f",$val/100) : $val', 414 PrintConvInv => '$val=~/^(\d+)\.(\d+)$/ ? sprintf("%.2d%.2d",$1,$2) : $val', 415 }, 416 Rv => { 417 Name => 'FirmwareVersion', 418 PrintConv => '$val=~/^\d+$/ ? sprintf("%.2f",$val/100) : $val', 419 PrintConvInv => '$val=~/^(\d+)\.(\d+)$/ ? sprintf("%.2d%.2d",$1,$2) : $val', 420 }, 207 421 Rg => 'RedGain', 208 422 Gg => 'GreenGain', … … 259 473 ); 260 474 475 # information stored in Ricoh AVI images (ref PH) 476 %Image::ExifTool::Ricoh::AVI = ( 477 GROUPS => { 0 => 'MakerNotes', 2 => 'Video' }, 478 ucmt => { 479 Name => 'Comment', 480 # Ricoh writes a "Unicode" header even when text is ASCII (spaces anyway) 481 ValueConv => '$_=$val; s/^(Unicode\0|ASCII\0\0\0)//; tr/\0//d; s/\s+$//; $_', 482 }, 483 mnrt => { 484 Name => 'MakerNoteRicoh', 485 SubDirectory => { 486 TagTable => 'Image::ExifTool::Ricoh::Main', 487 Start => '$valuePtr + 8', 488 ByteOrder => 'BigEndian', 489 Base => '8', 490 }, 491 }, 492 rdc2 => { 493 Name => 'RicohRDC2', 494 Unknown => 1, 495 ValueConv => 'unpack("H*",$val)', 496 # have seen values like 0a000444 and 00000000 - PH 497 }, 498 thum => { 499 Name => 'ThumbnailImage', 500 Binary => 1, 501 }, 502 ); 503 504 # Ricoh composite tags 505 %Image::ExifTool::Ricoh::Composite = ( 506 GROUPS => { 2 => 'Camera' }, 507 LensID => { 508 SeparateTable => 'Ricoh LensID', 509 Require => 'Ricoh:LensFirmware', 510 RawConv => '$val[0] ? $val[0] : undef', 511 ValueConv => '$val=~s/\s*:.*//; $val', 512 PrintConv => \%ricohLensIDs, 513 }, 514 ); 515 516 # add our composite tags 517 Image::ExifTool::AddCompositeTags('Image::ExifTool::Ricoh'); 518 519 261 520 #------------------------------------------------------------------------------ 262 521 # Process Ricoh text-based maker notes … … 281 540 return 0; 282 541 } 283 my $pos = 0;284 542 while ($data =~ m/([A-Z][a-z]{1,2})([0-9A-F]+);/sg) { 285 543 my $tag = $1; … … 419 677 =head1 AUTHOR 420 678 421 Copyright 2003-20 07, Phil Harvey (phil at owl.phy.queensu.ca)679 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca) 422 680 423 681 This library is free software; you can redistribute it and/or modify it
Note:
See TracChangeset
for help on using the changeset viewer.