Changeset 7740 for platform/tdiary/lib

Show
Ignore:
Timestamp:
03/10/08 05:57:05 (9 months ago)
Author:
drry
Message:

platform/tdiary/lib/exifparser/lib/exifparser/utils.rb
platform/tdiary/lib/exifparser/lib/exifparser/makernote/canon.rb
platform/tdiary/lib/exifparser/lib/exifparser/makernote/nikon.rb
platform/tdiary/lib/exifparser/lib/exifparser/makernote/nikon2.rb
platform/tdiary/lib/exifparser/lib/exifparser/makernote/minolta.rb
platform/tdiary/lib/exifparser/lib/exifparser/makernote/fujifilm.rb
platform/tdiary/lib/exifparser/lib/exifparser/makernote/olympus.rb
platform/tdiary/lib/exifparser/lib/exifparser/makernote/prove.rb
platform/tdiary/lib/exifparser/lib/exifparser/thumbnail.rb
platform/tdiary/lib/exifparser/lib/exifparser/scan.rb
platform/tdiary/lib/exifparser/lib/exifparser/tag.rb
platform/tdiary/lib/exifparser/lib/exifparser.rb
platform/tdiary/lib/exifparser/ChangeLog:

  • (white space changes.)
Location:
platform/tdiary/lib/exifparser
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/lib/exifparser/ChangeLog

    r4808 r7740  
    1212Thu Dec 12 04:05:42 2002 Ryuichi Tamura <r-tam@fsinet.or.jp> 
    1313 
    14         * lib/exifparser/tag.rb: EXIF tag set should include  
     14        * lib/exifparser/tag.rb: EXIF tag set should include 
    1515          'InteroperabilityIFDPointer' 
    1616 
    1717Tue Dec 10 23:26:46 2002 Ryuichi Tamura <r-tam@fsinet.or.jp> 
    1818 
    19         * lib/exifparser/scan.rb, lib/exifparser/tag.rb,  
     19        * lib/exifparser/scan.rb, lib/exifparser/tag.rb, 
    2020          lib/exifparser/makernote/*.rb: namespaces introduced to 
    2121          prevent name collision. 
     
    3131 
    3232        * lib/exifparser/tag.rb (Exif::Tag): missing tag classes 
    33           completed to make conformable with Exif Standard 2.2  
     33          completed to make conformable with Exif Standard 2.2 
    3434          (backward compatible newest standard). 
    3535          (Exif::Tag::Flash#to_s): returned value make comformable 
    3636          to Exif Standard 2.2. 
    37           (Exif::Tag::PixelXDimension, Exif::Tag::PixelYDimension):  
    38           renamed from 'ExifImageWidth' and 'ExifImageLength'.  
     37          (Exif::Tag::PixelXDimension, Exif::Tag::PixelYDimension): 
     38          renamed from 'ExifImageWidth' and 'ExifImageLength'. 
    3939 
    4040Sun Dec  8 15:27:27 2002 Ryuichi Tamura <r-tam@fsinet.or.jp> 
    41          
     41 
    4242        * Apply following fixes/contributions by Noguchi Shingo. 
    4343 
    4444        * lib/exifparser/makernote/nikon2.rb, 
    45           lib/exifparser/makernote/minolta.rb: new files.  
     45          lib/exifparser/makernote/minolta.rb: new files. 
    4646 
    4747        * lib/exifparser/scan.rb (Exif::Scanner#scan): Tag::Model object 
    4848          was generated by Tag::Model. This bug is fixed by Noguchi Shingo. 
    4949          (Exif::Scanner#scan): use @byteOrder_module to instantiate 
    50           makernote object. In many models, the byteorder of Makernote  
    51           seems the same as that of IFDs.  
    52          
     50          makernote object. In many models, the byteorder of Makernote 
     51          seems the same as that of IFDs. 
     52 
    5353        * lib/exifparser/makernote/*.rb (Exif::Makernote::XXX#initialize): 
    5454          ditto. 
     
    6060          return newly introduced models (Nikon, Nikon2, Minolta). 
    6161 
    62         * lib/exifparser/tag.rb (Exif::Tag::Makernote#_format0,  
    63           Exif::Tag::Makernote#to_s): the functionality of these methods  
     62        * lib/exifparser/tag.rb (Exif::Tag::Makernote#_format0, 
     63          Exif::Tag::Makernote#to_s): the functionality of these methods 
    6464          should be exchanged. 
    6565 
     
    8686 
    8787        * lib/exifparser/tag.rb (Exif::Tag::SubjectDistanceRange): ditto. 
    88           
     88 
    8989Wed Nov 20 13:28:16 2002 Ryuichi Tamura <r-tam@fsinet.or.jp> 
    9090 
    9191        * lib/exifparser/utils.rb: Utils::Pack::Motorola, 
    9292          Utils::Pack::Intel: new modules. these are extended to 
    93           objects that require decode data.  
     93          objects that require decode data. 
    9494 
    95         * lib/exifparser/scan.rb: __byteOrder__() is obsoleted.  
    96           objects that require decode data will extend appropriate  
     95        * lib/exifparser/scan.rb: __byteOrder__() is obsoleted. 
     96          objects that require decode data will extend appropriate 
    9797          decode modules according to the byte order. 
    9898          (Exif::Scanner#scan_IFD): ditto. 
    99           (Exif::Scanner#scan): check condition for valid EXIF  
    100           identifier is relaxed because some model does not provide  
     99          (Exif::Scanner#scan): check condition for valid EXIF 
     100          identifier is relaxed because some model does not provide 
    101101          the correct one. 
    102          
    103         * lib/exifparser/tag.rb (Exif::Tag::Format): now returns  
     102 
     103        * lib/exifparser/tag.rb (Exif::Tag::Format): now returns 
    104104          a pair of sizeof(format) and formatter module. 
    105105          (Exif::Tag::Formatter): modules provide 'format' method that 
     
    114114          the value of 'format' field of the data. 
    115115 
    116         * lib/exifparser/makernote/fujifilm.rb,  
     116        * lib/exifparser/makernote/fujifilm.rb, 
    117117          lib/exifparser/makernote/nikon.rb, 
    118118          lib/exifparser/makernote/canon.rb, 
     
    127127 
    128128        * lib/exifparser/scan.rb (Exif::Scanner#scan): some maker does not 
    129           provide any identifier. So pass Exif::Tag::Make object to  
     129          provide any identifier. So pass Exif::Tag::Make object to 
    130130          MakerNote.prove(), and use Exif::Tag::Make.value to prove the maker. 
    131131          (Exif::Scanner#get_app1_datasize): wrong shift length. 
     
    143143 
    144144        * lib/exifparser/tag.rb: Exif::Tag::ExifImageWidth, 
    145           Exif::Tag::ExifImageLength - added processData() to workaround.  
     145          Exif::Tag::ExifImageLength - added processData() to workaround. 
    146146          Exif::Tag::Base#to_name: should not use Module#nesting. revert to 
    147147          original behaviour. 
  • platform/tdiary/lib/exifparser/lib/exifparser.rb

    r4808 r7740  
    1 #  
     1# 
    22# 
    33#=  exifparser.rb - Exif tag parser written in pure ruby 
     
    99# 
    1010#== INTRODUCTION 
    11 #  
    12 #There are 2 classes you work with. ExifParser class is  
     11# 
     12#There are 2 classes you work with. ExifParser class is 
    1313#the Exif tag parser that parses all tags defined EXIF-2.2 standard, 
    1414#and many of extension tags uniquely defined by some digital equipment 
     
    2525# #<Exif::Tag::TIFF::Make ID=0x010f, IFD="IFD0" Name="Make", Format="Ascii" Value="FUJIFILM"> 
    2626# 
    27 #here, ID is Tag ID defined in EXIF-2.2 standard, IFD is the name of  
     27#here, ID is Tag ID defined in EXIF-2.2 standard, IFD is the name of 
    2828#Image File Directory, Name is String representation of tag ID, Format is 
    29 #string that shows how the data is formatted, and Value is the value of  
     29#string that shows how the data is formatted, and Value is the value of 
    3030#the tag. This is retrieved by Exif::Tag::Make#value. 
    31 #  
     31# 
    3232#Another example. If you want to know whether flash was fired when the image 
    3333#was generated, ExifParser returns Exif::Tag::Flash object: 
    34 #  
     34# 
    3535# tag = exif['Flash'] 
    3636# p tag 
     
    3939# => 1 
    4040# 
    41 #It may happen that diffrent IFDs have the same tag name. In this case,  
     41#It may happen that diffrent IFDs have the same tag name. In this case, 
    4242#use Exif#tag(tagname, IFD) 
    4343# 
    4444#The value of the tag above, 1, is not clearly understood 
    45 #(supposed to be 'true', though). Exif::Tag::Flash#to_s will provides  
     45#(supposed to be 'true', though). Exif::Tag::Flash#to_s will provides 
    4646#more human-readable form as String. 
    4747# 
     
    5454# 
    5555# exif = ExifParser.new("fujifilm.jpg") 
    56 #  
     56# 
    5757# 1. get a tag value by its name('Make') or its ID (0x010f) 
    5858# exif['Make'] #=> 'FUJIFILM' 
     
    6969# exif.tags 
    7070# 
    71 # or, if you want to know all the tags defined in specific IFD,  
     71# or, if you want to know all the tags defined in specific IFD, 
    7272# 
    7373# exif.tags(:IFD0) # get all the tags defined in IFD0 
     
    7878#   p tag.to_s 
    7979# end 
    80 #  
     80# 
    8181# # each tag in IFD0 
    8282# exif.each(:IFD0) do |ifd0_tag| 
     
    9191# 
    9292# dest object must respond to '<<'. 
    93 #  
     93# 
    9494require 'exifparser/scan' 
    9595 
     
    135135 
    136136    # 
    137     # search the specified tag values. return value is object of  
     137    # search the specified tag values. return value is object of 
    138138    # classes defined under Exif::Tag module. 
    139139    # 
     
    185185      else 
    186186        [ 
    187         @IFD0,  
    188          @IFD1, 
    189         @Exif, 
    190         @GPS, 
    191         @Interoperability, 
    192          @MakerNote 
     187          @IFD0, 
     188          @IFD1, 
     189          @Exif, 
     190          @GPS, 
     191          @Interoperability, 
     192          @MakerNote 
    193193        ].flatten 
    194194      end 
     
    198198    # execute given block with block argument being every tags defined 
    199199    # in all the IFDs contained in the image. 
    200     #  
     200    # 
    201201    # if argument ifd is specified, every tags defined in the 
    202202    # specified IFD are passed to block. 
     
    216216      else 
    217217        [ 
    218         @IFD0,  
    219          @IFD1, 
    220         @Exif, 
    221         @Interoperability, 
    222          @MakerNote 
    223         ].flatten.each do |tag|  
    224          yield tag  
     218          @IfD0, 
     219          @IFD1, 
     220          @Exif, 
     221          @Interoperability, 
     222          @MakerNote 
     223        ].flatten.each do |tag| 
     224          yield tag 
    225225        end 
    226226      end 
     
    231231    def search_tag(tagID, ifd=nil) 
    232232      if ifd 
    233         @scanner.result(ifd).find do |tag|  
    234           case tagID 
    235           when Fixnum 
    236             tag.tagID.hex == tagID 
    237           when String 
    238             tag.name == tagID 
    239           end 
    240         end 
     233        @scanner.result(ifd).find do |tag| 
     234          case tagID 
     235          when Fixnum 
     236            tag.tagID.hex == tagID 
     237          when String 
     238            tag.name == tagID 
     239          end 
     240        end 
    241241      else 
    242         [ 
    243         @IFD0, 
    244         @IFD1, 
    245         @Exif, 
    246         @GPS, 
    247         @Interoperability, 
    248         @MakerNote 
    249         ].flatten.find do |tag|  
    250           case tagID 
    251           when Fixnum 
    252             tag.tagID.hex == tagID 
    253           when String 
    254             tag.name == tagID 
    255           end 
    256         end 
     242        [ 
     243          @IFD0, 
     244          @IFD1, 
     245          @Exif, 
     246          @GPS, 
     247          @Interoperability, 
     248          @MakerNote 
     249        ].flatten.find do |tag| 
     250          case tagID 
     251          when Fixnum 
     252            tag.tagID.hex == tagID 
     253          when String 
     254            tag.name == tagID 
     255          end 
     256        end 
    257257      end 
    258258    end 
  • platform/tdiary/lib/exifparser/lib/exifparser/makernote/canon.rb

    r4808 r7740  
    2525      class Tag0x0001 < Base 
    2626 
    27         def processData 
    28           @formatted = [] 
    29           partition_data(@count) do |part| 
    30             @formatted.push _formatData(part) 
    31           end 
    32         end 
    33          
    34         def value 
    35           numTags = @formatted[0] / 2 
    36           ret = {} 
    37  
    38           return ret if numTags < 2 
    39           # 
    40           # offset 1 : Macro mode 
    41           # 
    42           ret["Macro mode"] = 
    43           case @formatted[1] 
    44           when 1 
    45             "Macro" 
    46           when 2 
    47             "Normal" 
    48           else 
    49             "Unknown" 
    50           end 
    51  
    52           return ret if numTags < 3 
    53           # 
    54           # offset 2 : if nonzero, length of self-timer in 10ths of a second. 
    55           #   
    56           selftimer_length = @formatted[2] 
    57  
    58           return ret if numTags < 5 
    59           # 
    60           # offset 4 : Flash mode 
    61           # 
    62           ret["Flash mode"] = 
    63           case @formatted[4] 
    64           when 0 
    65             "flash not fired" 
    66           when 1 
    67             "auto" 
    68           when 2 
    69             "on" 
    70           when 3 
    71             "red-eye reduction" 
    72           when 4 
    73             "slow synchro" 
    74           when 5 
    75             "auto + redeye reduction" 
    76           when 6 
    77             "on + redeye reduction" 
    78           when 16 
    79             "external flash" 
    80           else 
    81             "unknown" 
    82           end 
    83  
    84           return ret if numTags < 6 
    85           # 
    86           # offset 5: Contiuous drive mode 
    87           # 
    88           ret["Continuous drive mode"] = 
    89           case @formatted[5] 
    90           when 0 
    91             if selftimer_length != 0 
    92               "Timer = #{selftimer_length/10.0}sec." 
    93             else 
    94               "Single" 
    95             end 
    96           when 1 
    97             "Continuous" 
    98           end 
    99            
    100           return ret if numTags < 8 
    101           # 
    102           # offset 7: Focus Mode 
    103           # 
    104           ret["Focus Mode"] = 
    105           case @formatted[7] 
    106           when 0 
    107             "One-Shot" 
    108           when 1 
    109             "AI Servo" 
    110           when 2 
    111             "AI Focus" 
    112           when 3 
    113             "MF" 
    114           when 4 
    115             "Single" 
    116           when 5 
    117             "Continuous" 
    118           when 6 
    119             "MF" 
    120           else 
    121             "Unknown" 
    122           end 
    123  
    124           return ret if numTags < 11 
    125           # 
    126           # offset 10: Image size 
    127           # 
    128           ret["Image Size"] = 
    129           case @formatted[10] 
    130           when 0 
    131             "Large" 
    132           when 1 
    133             "Medium" 
    134           when 
    135             "Small" 
    136           else  
    137             "Unknown" 
    138           end 
    139  
    140           return ret if numTags < 12 
    141           # 
    142           # offset 11: "Easy shooting" mode 
    143           # 
    144           ret["Easy shooting mode"] = 
    145           case @formatted[11] 
    146           when 0 
    147             "Full auto" 
    148           when 1 
    149             "Manual" 
    150           when 2 
    151             "Landscape" 
    152           when 3 
    153             "Fast Shutter" 
    154           when 4 
    155             "Slow Shutter" 
    156           when 5 
    157             "Night" 
    158           when 6 
    159             "B&W" 
    160           when 7 
    161             "Sepia" 
    162           when 8 
    163             "Portrait" 
    164           when 9 
    165             "Sports" 
    166           when 10 
    167             "Macro / Close-Up" 
    168           when 11 
    169             "Pan Focus" 
    170           else 
    171             "Unknown" 
    172           end 
    173  
    174           return ret if numTags < 14 
    175           # 
    176           # offset 13: Contrast 
    177           # 
    178           ret["Contrast"] = 
    179           case @formatted[13] 
    180           when 0xffff 
    181             "Low" 
    182           when 0x0000 
    183             "Normal" 
    184           when 0x0001 
    185             "High" 
    186           else 
    187             "Unknown" 
    188           end 
    189  
    190           return ret if numTags < 15 
    191           # 
    192           # offset 14: Saturation 
    193           # 
    194           ret["Saturation"] = 
    195           case @formatted[14] 
    196           when 0xffff 
    197             "Low" 
    198           when 0x0000 
    199             "Normal" 
    200           when 0x0001 
    201             "High" 
    202           else 
    203             "Unknown" 
    204           end 
    205  
    206           return ret if numTags < 16 
    207           # 
    208           # offset 15: Contrast 
    209           # 
    210           ret["Sharpness"] = 
    211           case @formatted[15] 
    212           when 0xffff 
    213             "Low" 
    214           when 0x0000 
    215             "Normal" 
    216           when 0x0001 
    217             "High" 
    218           else 
    219             "Unknown" 
    220           end 
    221  
    222           return ret if numTags < 17 
    223           # 
    224           # offset 16: ISO 
    225           # 
    226           ret["ISO"] = 
    227           case @formatted[16] 
    228           when 0 
    229             "ISOSpeedRatings" 
    230           when 15 
    231             "Auto" 
    232           when 16 
    233             50 
    234           when 17 
    235             100 
    236           when 18 
    237             200 
    238           when 19 
    239             400 
    240           else 
    241             "Unknown" 
    242           end 
    243            
    244           return ret if numTags < 18 
    245           # 
    246           # offset 17: Metering mode 
    247           # 
    248           ret['Metering mode'] = 
    249           case @formatted[17] 
    250           when 3 
    251             "Evaluative" 
    252           when 4 
    253             "Partial" 
    254           when 5 
    255             "Center-weighted" 
    256           else 
    257             "Unknown" 
    258           end 
    259           ret 
    260         end 
     27        def processData 
     28          @formatted = [] 
     29          partition_data(@count) do |part| 
     30            @formatted.push _formatData(part) 
     31          end 
     32        end 
     33 
     34        def value 
     35          numTags = @formatted[0] / 2 
     36          ret = {} 
     37 
     38          return ret if numTags < 2 
     39          # 
     40          # offset 1 : Macro mode 
     41          # 
     42          ret["Macro mode"] = 
     43          case @formatted[1] 
     44          when 1 
     45            "Macro" 
     46          when 2 
     47            "Normal" 
     48          else 
     49            "Unknown" 
     50          end 
     51 
     52          return ret if numTags < 3 
     53          # 
     54          # offset 2 : if nonzero, length of self-timer in 10ths of a second. 
     55          # 
     56          selftimer_length = @formatted[2] 
     57 
     58          return ret if numTags < 5 
     59          # 
     60          # offset 4 : Flash mode 
     61          # 
     62          ret["Flash mode"] = 
     63          case @formatted[4] 
     64          when 0 
     65            "flash not fired" 
     66          when 1 
     67            "auto" 
     68          when 2 
     69            "on" 
     70          when 3 
     71            "red-eye reduction" 
     72          when 4 
     73            "slow synchro" 
     74          when 5 
     75            "auto + redeye reduction" 
     76          when 6 
     77            "on + redeye reduction" 
     78          when 16 
     79            "external flash" 
     80          else 
     81            "unknown" 
     82          end 
     83 
     84          return ret if numTags < 6 
     85          # 
     86          # offset 5: Contiuous drive mode 
     87          # 
     88          ret["Continuous drive mode"] = 
     89          case @formatted[5] 
     90          when 0 
     91            if selftimer_length != 0 
     92              "Timer = #{selftimer_length/10.0}sec." 
     93            else 
     94              "Single" 
     95            end 
     96          when 1 
     97            "Continuous" 
     98          end 
     99 
     100          return ret if numTags < 8 
     101          # 
     102          # offset 7: Focus Mode 
     103          # 
     104          ret["Focus Mode"] = 
     105          case @formatted[7] 
     106          when 0 
     107            "One-Shot" 
     108          when 1 
     109            "AI Servo" 
     110          when 2 
     111            "AI Focus" 
     112          when 3 
     113            "MF" 
     114          when 4 
     115            "Single" 
     116          when 5 
     117            "Continuous" 
     118          when 6 
     119            "MF" 
     120          else 
     121        </