Changeset 7739 for platform/tdiary/lib

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

platform/tdiary/lib/rexif_gps.rb:

  • (white space changes.)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/lib/rexif_gps.rb

    r5058 r7739  
    44# 
    55# kp <k-nomura@s6.dion.ne.jp> 
    6 #  
     6# 
    77# オリジナルからの変更点 
    88#  ・InterOperabilityIFD対応削除 
     
    1515 
    1616class Exif<Jpeg::Segment 
    17     class ParseError<Jpeg::ParseError 
    18     end 
    19  
    20     # 
    21     # Data with read class  
    22     # 
    23     class Data 
    24         PACKSTR={ 
    25             :le=>{ 
    26                 :ushort=>'v*', 
    27                 :ulong=>'V*', 
    28                 :float=>'e*', 
    29                 :double=>'E*' 
    30             }.freeze, 
    31             :be=>{ 
    32                 :ushort=>'n*', 
    33                 :ulong=>'N*', 
    34                 :float=>'g*', 
    35                 :double=>'G*' 
    36             }.freeze 
    37         } 
    38         PACKSTR.freeze 
    39  
    40         def initialize(data,endian=:le) 
    41             @data=data 
    42             @endian=endian 
    43         end 
    44         attr_reader :endian 
    45  
    46         def get_ushort(offset=0) 
    47             self.read_ushort(offset,1).first 
    48         end 
    49         def get_ulong(offset=0) 
    50             self.read_ulong(offset,1).first 
    51         end 
    52          
    53         def read_char(offset=0,n=1) 
    54             @data[offset..offset+n-1] 
    55         end 
    56         def read_ascii(offset=0,n=1) 
    57             @data[offset..offset+n-1].unpack('A*') 
    58         end 
    59         def read_byte(offset=0,n=1) 
    60             @data[offset..offset+n-1].unpack('c*') 
    61         end 
    62         def read_ubyte(offset=0,n=1) 
    63             @data[offset..offset+n-1].unpack('C*') 
    64         end 
    65         def read_short(offset=0,n=1) 
    66             self.read_ushort(offset,n).pack('s*').unpack('s*') 
    67         end 
    68         def read_long(offset=0,n=1) 
    69             self.read_ulong(offset,n).pack('l*').unpack('l*') 
    70         end 
    71         def read_rational(offset=0,n=1) 
    72             ret=[] 
    73             buf=self.read_long(offset,n*2) 
    74             until(buf.empty?) 
    75                 ret.push(Exif::Rational.new!(buf.shift,buf.shift)) 
    76             end 
    77             ret 
    78         end 
    79         def read_urational(offset=0,n=1) 
    80             ret=[] 
    81             buf=self.read_ulong(offset,n*2) 
    82             until(buf.empty?) 
    83                 ret.push(Exif::Rational.new!(buf.shift,buf.shift)) 
    84             end 
    85             ret 
    86         end 
    87  
    88         def read_ushort(offset=0,n=1) 
    89             @data[offset..offset+n*2-1].unpack(PACKSTR[@endian][:ushort]) 
    90         end 
    91         def read_ulong(offset=0,n=1) 
    92             @data[offset..offset+n*4-1].unpack(PACKSTR[@endian][:ulong]) 
    93         end 
    94         def read_float(offset=0,n=1) 
    95             @data[offset..offset+n*4-1].unpack(PACKSTR[@endian][:float]) 
    96         end 
    97         def read_double(offset=0,n=1) 
    98             @data[offset..offset+n*8-1].unpack(PACKSTR[@endian][:double]) 
    99         end 
    100  
    101         def to_s 
    102             @data 
    103         end 
    104         alias dump to_s 
    105  
    106         def size 
    107             @data.size 
    108         end 
    109  
    110         def Data.new_char(x,endian=:le) 
    111             Data.new(x.to_s,endian) 
    112         end 
    113         def Data.new_ascii(x,endian=:le) 
    114             Data.new(x.to_a.pack('A*')+"\x00",endian) 
    115         end 
    116         def Data.new_byte(x,endian=:le) 
    117             Data.new(x.to_a.pack('c*'),endian) 
    118         end 
    119         def Data.new_ubyte(x,endian=:le) 
    120             Data.new(x.to_a.pack('C*'),endian) 
    121         end 
    122         def Data.new_short(x,endian=:le) 
    123             Data.new(x.to_a.pack('s*'). 
    124                      unpack(PACKSTR[endian][:ushort]). 
    125                      pack(PACKSTR[endian][:ushort]), 
    126                      endian) 
    127         end 
    128         def Data.new_ushort(x,endian=:le) 
    129             Data.new(x.to_a.pack(PACKSTR[endian][:ushort]), 
    130                      endian) 
    131         end 
    132         def Data.new_long(x,endian=:le) 
    133             Data.new(x.to_a.pack('l*'). 
    134                      unpack(PACKSTR[endian][:ulong]). 
    135                      pack(PACKSTR[endian][:ulong]), 
    136                      endian) 
    137         end 
    138         def Data.new_ulong(x,endian=:le) 
    139             Data.new(x.to_a.pack(PACKSTR[endian][:ulong]),endian) 
    140         end 
    141         def Data.new_rational(x,endian=:le) 
    142             Data.new_long(x.to_a.map{|a| a.to_a}.flatten, 
    143                           endian) 
    144         end 
    145         def Data.new_urational(x,endian=:le) 
    146             Data.new_ulong(x.to_a.map{|a| a.to_a}.flatten, 
    147                            endian) 
    148         end 
    149         def Data.new_float(x,endian=:le) 
    150             Data.new(x.to_a.pack(PACKSTR[endian][:float]),endian) 
    151         end 
    152         def Data.new_double(x,endian=:le) 
    153             Data.new(x.to_a.pack(PACKSTR[endian][:double]),endian) 
    154         end 
    155     end 
    156  
    157     class Rational<Rational 
    158         def to_a 
    159             [@numerator,@denominator] 
    160         end 
    161     end 
    162  
    163     # 
    164     # Exif::Ifd 
    165     # 
    166     class Ifd<Array 
     17        class ParseError<Jpeg::ParseError 
     18        end 
    16719 
    16820        # 
    169         # Exif::Ifd::Directory 
     21        # Data with read class 
    17022        # 
    171         class Directory 
    172             # 
    173             # Tag Names 
    174             # 
    175 #           InteroperabilityIndex=0x0001 
    176 #           InteroperabilityVersion=0x0002 
     23        class Data 
     24                PACKSTR={ 
     25                        :le=>{ 
     26                                :ushort=>'v*', 
     27                                :ulong=>'V*', 
     28                                :float=>'e*', 
     29                                :double=>'E*' 
     30                        }.freeze, 
     31                        :be=>{ 
     32                                :ushort=>'n*', 
     33                                :ulong=>'N*', 
     34                                :float=>'g*', 
     35                                :double=>'G*' 
     36                        }.freeze 
     37                } 
     38                PACKSTR.freeze 
     39 
     40                def initialize(data,endian=:le) 
     41                        @data=data 
     42                        @endian=endian 
     43                end 
     44                attr_reader :endian 
     45 
     46                def get_ushort(offset=0) 
     47                        self.read_ushort(offset,1).first 
     48                end 
     49                def get_ulong(offset=0) 
     50                        self.read_ulong(offset,1).first 
     51                end 
     52 
     53                def read_char(offset=0,n=1) 
     54                        @data[offset..offset+n-1] 
     55                end 
     56                def read_ascii(offset=0,n=1) 
     57                        @data[offset..offset+n-1].unpack('A*') 
     58                end 
     59                def read_byte(offset=0,n=1) 
     60                        @data[offset..offset+n-1].unpack('c*') 
     61                end 
     62                def read_ubyte(offset=0,n=1) 
     63                        @data[offset..offset+n-1].unpack('C*') 
     64                end 
     65                def read_short(offset=0,n=1) 
     66                        self.read_ushort(offset,n).pack('s*').unpack('s*') 
     67                end 
     68                def read_long(offset=0,n=1) 
     69                        self.read_ulong(offset,n).pack('l*').unpack('l*') 
     70                end 
     71                def read_rational(offset=0,n=1) 
     72                        ret=[] 
     73                        buf=self.read_long(offset,n*2) 
     74                        until(buf.empty?) 
     75                                ret.push(Exif::Rational.new!(buf.shift,buf.shift)) 
     76                        end 
     77                        ret 
     78                end 
     79                def read_urational(offset=0,n=1) 
     80                        ret=[] 
     81                        buf=self.read_ulong(offset,n*2) 
     82                        until(buf.empty?) 
     83                                ret.push(Exif::Rational.new!(buf.shift,buf.shift)) 
     84                        end 
     85                        ret 
     86                end 
     87 
     88                def read_ushort(offset=0,n=1) 
     89                        @data[offset..offset+n*2-1].unpack(PACKSTR[@endian][:ushort]) 
     90                end 
     91                def read_ulong(offset=0,n=1) 
     92                        @data[offset..offset+n*4-1].unpack(PACKSTR[@endian][:ulong]) 
     93                end 
     94                def read_float(offset=0,n=1) 
     95                        @data[offset..offset+n*4-1].unpack(PACKSTR[@endian][:float]) 
     96                end 
     97                def read_double(offset=0,n=1) 
     98                        @data[offset..offset+n*8-1].unpack(PACKSTR[@endian][:double]) 
     99                end 
     100 
     101                def to_s 
     102                        @data 
     103                end 
     104                alias dump to_s 
     105 
     106                def size 
     107                        @data.size 
     108                end 
     109 
     110                def Data.new_char(x,endian=:le) 
     111                        Data.new(x.to_s,endian) 
     112                end 
     113                def Data.new_ascii(x,endian=:le) 
     114                        Data.new(x.to_a.pack('A*')+"\x00",endian) 
     115                end 
     116                def Data.new_byte(x,endian=:le) 
     117                        Data.new(x.to_a.pack('c*'),endian) 
     118                end 
     119                def Data.new_ubyte(x,endian=:le) 
     120                        Data.new(x.to_a.pack('C*'),endian) 
     121                end 
     122                def Data.new_short(x,endian=:le) 
     123                        Data.new(x.to_a.pack('s*'). 
     124                                    unpack(PACKSTR[endian][:ushort]). 
     125                                    pack(PACKSTR[endian][:ushort]), 
     126                                 endian) 
     127                end 
     128                def Data.new_ushort(x,endian=:le) 
     129                        Data.new(x.to_a.pack(PACKSTR[endian][:ushort]), 
     130                                 endian) 
     131                end 
     132                def Data.new_long(x,endian=:le) 
     133                        Data.new(x.to_a.pack('l*'). 
     134                                    unpack(PACKSTR[endian][:ulong]). 
     135                                    pack(PACKSTR[endian][:ulong]), 
     136                                 endian) 
     137                end 
     138                def Data.new_ulong(x,endian=:le) 
     139                        Data.new(x.to_a.pack(PACKSTR[endian][:ulong]),endian) 
     140                end 
     141                def Data.new_rational(x,endian=:le) 
     142                        Data.new_long(x.to_a.map{|a| a.to_a}.flatten, 
     143                                      endian) 
     144                end 
     145                def Data.new_urational(x,endian=:le) 
     146                        Data.new_ulong(x.to_a.map{|a| a.to_a}.flatten, 
     147                                       endian) 
     148                end 
     149                def Data.new_float(x,endian=:le) 
     150                        Data.new(x.to_a.pack(PACKSTR[endian][:float]),endian) 
     151                end 
     152                def Data.new_double(x,endian=:le) 
     153                        Data.new(x.to_a.pack(PACKSTR[endian][:double]),endian) 
     154                end 
     155        end 
     156 
     157        class Rational<Rational 
     158                def to_a 
     159                        [@numerator,@denominator] 
     160                end 
     161        end 
     162 
     163        # 
     164        # Exif::Ifd 
     165        # 
     166        class Ifd<Array 
     167 
     168                # 
     169                # Exif::Ifd::Directory 
     170                # 
     171                class Directory 
     172                        # 
     173                        # Tag Names 
     174                        # 
     175                        #    InteroperabilityIndex=0x0001 
     176                        #    InteroperabilityVersion=0x0002 
    177177 
    178178# gps tags 
    179179# added by kp 
    180180 
    181                 VersionID=0x0000 
    182                 LatitudeRef=0x0001 
    183                 Latitude=0x0002 
    184                 LongitudeRef=0x0003 
    185                 Longitude=0x0004 
    186                 AltitudeRef=0x0005 
    187                 Altitude=0x0006 
    188                 TimeStamp=0x0007 
    189                 Satellites=0x0008 
    190                 Status=0x0009 
    191                 MeasureMode=0x000a 
    192                 Dop=0x000b 
    193                 SpeedRef=0x000c 
    194                 Speed=0x000d 
    195                 TrackRef=0x000e 
    196                 Track=0x000f 
    197                 ImgDirectionRef=0x0010 
    198                 ImgDirection=0x0011 
    199                 MapDatum=0x0012 
    200                 DestLatitudeRef=0x0013 
    201                 DestLatitude=0x0014 
    202                 DestLongitudeRef=0x0015 
    203                 DestLongitude=0x0016 
    204                 DestBearingRef=0x0017 
    205                 DestBearing=0x0018 
    206                 DestDistanceRef=0x0019 
    207                 DestDistance=0x001a 
    208                 ProcessingMethod=0x001b 
    209                 AreaInformation=0x001c 
    210                 DataStamp=0x001d 
    211                 Differential=0x001e 
    212                  
    213             NewSubfileType=0x00fe 
    214             SubfileType=0x00ff 
    215             ImageWidth=0x0100 
    216             ImageLength=0x0101 
    217             BitsPerSample=0x0102 
    218             Compression=0x0103 
    219             PhotometricInterpretation=0x0106 
    220             ImageDescription=0x010e 
    221             Maker=0x010f 
    222             Model=0x0110 
    223             StripOffsets=0x0111 
    224             Orientation=0x0112 
    225             SamplesPerPixel=0x0115 
    226             RowsPerStrip=0x0116 
    227             StripByteConunts=0x0117 
    228             XResolution=0x011a 
    229             YResolution=0x011b 
    230             PlanarConfiguration=0x011c 
    231             ResolutionUnit=0x0128 
    232             TransferFunction=0x012d 
    233             Software=0x0131 
    234             DateTime=0x0132 
    235             Artist=0x013b 
    236             Predictor=0x013d 
    237             WhitePoint=0x013e 
    238             PrimaryChromaticities=0x013f 
    239             TileWidth=0x0142 
    240             TileLength=0x0143 
    241             TileOffsets=0x0144 
    242             TileByteCounts=0x0145 
    243             SubIFDs=0x014a 
    244             JPEGTables=0x015b 
    245             JpegInterchangeFormat=0x0201 
    246             JpegInterchangeFormatLength=0x0202 
    247             YCbCrCoefficients=0x0211 
    248             YCbCrSubSampling=0x0212 
    249             YCbCrPositioning=0x0213 
    250             ReferenceBlackWhite=0x0214 
    251             RelatedImageFileFormat=0x1000 
    252             RelatedImageWidth=0x1001 
    253             CFARepeatPatternDim=0x828d 
    254             CFAPattern=0x828e 
    255             BatteryLevel=0x828f 
    256             Copyright=0x8298 
    257             ExposureTime=0x829a 
    258             FNumber=0x829d 
    259             IPTC_NAA=0x83bb 
    260             ExifIFDPointer=0x8769 
    261             InterColorProfile=0x8773 
    262             ExposureProgram=0x8822 
    263             SpectralSensitivity=0x8824 
    264             GPSIFDPointer=0x8825                #GPSInfo -> GPSIFDPointer 
    265             ISOSpeedRatings=0x8827 
    266             OECF=0x8828 
    267             Interlace=0x8829 
    268             TimeZoneOffset=0x882a 
    269             SelfTimerMode=0x882b 
    270             ExifVersion=0x9000 
    271             DateTimeOriginal=0x9003 
    272             DateTimeDigitized=0x9004 
    273             ComponentsConfiguration=0x9101 
    274             CompressedBitsPerPixel=0x9102 
    275             ShutterSpeedValue=0x9201 
    276             ApertureValue=0x9202 
    277             BrightnessValue=0x9203 
    278             ExposureBiasValue=0x9204 
    279             MaxApertureValue=0x9205 
    280             SubjectDistance=0x9206 
    281             MeteringMode=0x9207 
    282             LightSource=0x9208 
    283             Flash=0x9209 
    284             FocalLength=0x920a 
    285             FlashEnergy=0x920b 
    286             SpatialFrequencyResponse=0x920c 
    287             Noise=0x920d 
    288             ImageNumber=0x9211 
    289             SecurityClassification=0x9212 
    290             ImageHistory=0x9213 
    291             SubjectLocation=0x9214 
    292             ExposureIndex=0x9215 
    293             TIFF_EPStandardID=0x9216 
    294             MakerNote=0x927c 
    295             UserComment=0x9286 
    296             SubSecTime=0x9290 
    297             SubSecTimeOriginal=0x9291 
    298             SubSecTimeDigitized=0x9292 
    299             FlashPixVersion=0xa000 
    300             ColorSpace=0xa001 
    301             ExifImageWidth=0xa002 
    302             ExifImageHeight=0xa003 
    303             RelatedSoundFile=0xa004 
    304             InteroperabilityIFDPointer=0xa005 
    305             FlashEnergy2=0xa20b 
    306             SpatialFrequencyResponse2=0xa20c 
    307             FocalPlaneXResolution=0xa20e 
    308             FocalPlaneYResolution=0xa20f 
    309             FocalPlaneResolutionUnit=0xa210 
    310             SubjectLocation2=0xa214 
    311             ExposureIndex2=0xa215 
    312             SensingMethod=0xa217 
    313             FileSource=0xa300 
    314             SceneType=0xa301 
    315             CFAPattern2=0xa302 
    316              
    317             class TagInfo 
    318                 def initialize(name,format,limit=0) 
    319                     @name=name 
    320                     @format=format.to_a.freeze 
    321                     @limit=limit 
    322                 end 
    323                 attr_reader :name,:format,:limit 
    324             end 
    325  
    326             TAG_NAME={ 
    327 #               0x0001=>TagInfo.new("InteroperabilityIndex",[2],0), 
    328 #               0x0002=>TagInfo.new("InteroperabilityVersion",[7],4), 
    329  
    330                 0x0000=>TagInfo.new("VersionID",[1],4), 
    331                 0x0001=>TagInfo.new("LatitudeRef",[2],2), 
    332                 0x0002=>TagInfo.new("Latitude",[5],3), 
    333                 0x0003=>TagInfo.new("LongitudeRef",[2],2), 
    334                 0x0004=>TagInfo.new("Longitude",[5],3), 
    335                 0x0005=>TagInfo.new("AltitudeRef",[1],1), 
    336                 0x0006=>TagInfo.new("Altitude",[5],1), 
    337                 0x0007=>TagInfo.new("TimeStamp",[5],3), 
    338                 0x0008=>TagInfo.new("Satellites",[1],0), 
    339                 0x0009=>TagInfo.new("Status",[2],2), 
    340                 0x000a=>TagInfo.new("MeasureMode",[2],2), 
    341                 0x000b=>TagInfo.new("Dop",[5],1), 
    342                 0x000c=>TagInfo.new("SpeedRef",[2],2), 
    343                 0x000d=>TagInfo.new("Speed",[5],1), 
    344                 0x000e=>TagInfo.new("TrackRef",[2],2), 
    345                 0x000f=>TagInfo.new("Track",[5],1), 
    346                 0x0010=>TagInfo.new("ImgDirectionRef",[2],2), 
    347                 0x0011=>TagInfo.new("ImgDirection",[5],1), 
    348                 0x0012=>TagInfo.new("MapDatum",[2],0), 
    349                 0x0013=>TagInfo.new("DestLatitudeRef",[2],2), 
    350                 0x0014=>TagInfo.new("DestLatitude",[5],3), 
    351                 0x0015=>TagInfo.new("DestLongitudeRef",[2],2), 
    352                 0x0016=>TagInfo.new("DestLongitude",[5],3), 
    353                 0x0017=>TagInfo.new("DestBearingRef",[2],2), 
    354                 0x0018=>TagInfo.new("DestBearing",[5],1), 
    355                 0x0019=>TagInfo.new("DestDistanceRef",[2],2), 
    356                 0x001a=>TagInfo.new("DestDistance",[5],1), 
    357                 0x001b=>TagInfo.new("ProcessingMethod",[7],0), 
    358                 0x001c=>TagInfo.new("AreaInformation",[7],0), 
    359                 0x001d=>TagInfo.new("DataStamp",[2],11), 
    360                 0x001e=>TagInfo.new("Differential",[3],1), 
    361  
    362                 0x00fe=>TagInfo.new("NewSubfileType",[4],1), 
    363                 0x00ff=>TagInfo.new("SubfileType",[3],1), 
    364                 0x0100=>TagInfo.new("ImageWidth",[3,9],1), 
    365                 0x0101=>TagInfo.new("ImageLength",[3,9],1), 
    366                 0x0102=>TagInfo.new("BitsPerSample",[3],3), 
    367                 0x0103=>TagInfo.new("Compression",[3],1), 
    368                 0x0106=>TagInfo.new("PhotometricInterpretation",[3],1), 
    369                 0x010e=>TagInfo.new("ImageDescription",[2],0), 
    370                 0x010f=>TagInfo.new("Maker",[2],0), 
    371                 0x0110=>TagInfo.new("Model",[2],0), 
    372                 0x0111=>TagInfo.new("StripOffsets",[3,9],0), 
    373                 0x0112=>TagInfo.new("Orientation",[3],1), 
    374                 0x0115=>TagInfo.new("SamplesPerPixel",[3],1), 
    375                 0x0116=>TagInfo.new("RowsPerStrip",[3,9],1), 
    376                 0x0117=>TagInfo.new("StripByteConunts",[3,9],0), 
    377                 0x011a=>TagInfo.new("XResolution",[5],1), 
    378                 0x011b=>TagInfo.new("YResolution",[5],1), 
    379                 0x011c=>TagInfo.new("PlanarConfiguration",[3],1), 
    380                 0x0128=>TagInfo.new("ResolutionUnit",[3],1), 
    381                 0x012d=>TagInfo.new("TransferFunction",[3],3), 
    382                 0x0131=>TagInfo.new("Software",[2],0), 
    383                 0x0132=>TagInfo.new("DateTime",[2],20), 
    384                 0x013b=>TagInfo.new("Artist",[2],0), 
    385                 0x013d=>TagInfo.new("Predictor",[3],1), 
    386                 0x013e=>TagInfo.new("WhitePoint",[5],2), 
    387                 0x013f=>TagInfo.new("PrimaryChromaticities",[5],6), 
    388                 0x0142=>TagInfo.new("TileWidth",[3],1), 
    389                 0x0143=>TagInfo.new("TileLength",[3],1), 
    390                 0x0144=>TagInfo.new("TileOffsets",[4],0), 
    391                 0x0145=>TagInfo.new("TileByteCounts",[3],0), 
    392                 0x014a=>TagInfo.new("SubIFDs",[4],0), 
    393                 0x015b=>TagInfo.new("JPEGTables",[7],0), 
    394                 0x0201=>TagInfo.new("JpegInterchangeFormat",[4],1), 
    395                 0x0202=>TagInfo.new("JpegInterchangeFormatLength",[4],1), 
    396                 0x0211=>TagInfo.new("YCbCrCoefficients",[5],3), 
    397                 0x0212=>TagInfo.new("YCbCrSubSampling",[3],2), 
    398                 0x0213=>TagInfo.new("YCbCrPositioning",[3],1), 
    399                 0x0214=>TagInfo.new("ReferenceBlackWhite",[5],6), 
    400                 0x1000=>TagInfo.new("RelatedImageFileFormat",[2],0), 
    401                 0x1001=>TagInfo.new("RelatedImageLength",[8],0), 
    402                 0x1001=>TagInfo.new("RelatedImageWidth",[8],0), 
    403                 0x828d=>TagInfo.new("CFARepeatPatternDim",[3],2), 
    404                 0x828e=>TagInfo.new("CFAPattern",[1],0), 
    405                 0x828f=>TagInfo.new("BatteryLevel",[5],1), 
    406                 0x8298=>TagInfo.new("Copyright",[2],0), 
    407                 0x829a=>TagInfo.new("ExposureTime",[5],1), 
    408                 0x829d=>TagInfo.new("FNumber",[5],1), 
    409                 0x83bb=>TagInfo.new("IPTC_NAA",[4],0), 
    410                 0x8769=>TagInfo.new("ExifIFDPointer",[4],1), 
    411                 0x8773=>TagInfo.new("InterColorProfile",[7],0), 
    412                 0x8822=>TagInfo.new("ExposureProgram",[3],1), 
    413                 0x8824=>TagInfo.new("SpectralSensitivity",[2],0), 
    414                 0x8825=>TagInfo.new("GPSIFDPointer",[4],1), 
    415                 0x8827=>TagInfo.new("ISOSpeedRatings",[3],2), 
    416                 0x8828=>TagInfo.new("OECF",[7],0), 
    417                 0x8829=>TagInfo.new("Interlace",[3],1), 
    418                 0x882a=>TagInfo.new("TimeZoneOffset",[8],1), 
    419                 0x882b=>TagInfo.new("SelfTimerMode",[3],1), 
    420                 0x9000=>TagInfo.new("ExifVersion",[7],4), 
    421                 0x9003=>TagInfo.new("DateTimeOriginal",[2],20), 
    422                 0x9004=>TagInfo.new("DateTimeDigitized",[2],20), 
    423                 0x9101=>TagInfo.new("ComponentsConfiguration",[7],4), 
    424                 0x9102=>TagInfo.new("CompressedBitsPerPixel",[5],1), 
    425                 0x9201=>TagInfo.new("ShutterSpeedValue",[10],1), 
    426                 0x9202=>TagInfo.new("ApertureValue",[5],1), 
    427                 0x9203=>TagInfo.new("BrightnessValue",[10],1), 
    428                 0x9204=>TagInfo.new("ExposureBiasValue",[10],1), 
    429                 0x9205=>TagInfo.new("MaxApertureValue",[5],1), 
    430                 0x9206=>TagInfo.new("SubjectDistance",[10],1), 
    431                 0x9207=>TagInfo.new("MeteringMode",[3],1), 
    432                 0x9208=>TagInfo.new("LightSource",[3],1), 
    433                 0x9209=>TagInfo.new("Flash",[3],1), 
    434                 0x920a=>TagInfo.new("FocalLength",[5],1), 
    435                 0x920b=>TagInfo.new("FlashEnergy",[5],1), 
    436                 0x920c=>TagInfo.new("SpatialFrequencyResponse",[7],0), 
    437                 0x920d=>TagInfo.new("Noise",[7],0), 
    438                 0x9211=>TagInfo.new("ImageNumber",[4],1), 
    439                 0x9212=>TagInfo.new("SecurityClassification",[2],1), 
    440                 0x9213=>TagInfo.new("ImageHistory",[2],0), 
    441                 0x9214=>TagInfo.new("SubjectLocation",[3],4), 
    442                 0x9215=>TagInfo.new("ExposureIndex",[5],1), 
    443                 0x9216=>TagInfo.new("TIFF_EPStandardID",[1],4), 
    444                 0x927c=>TagInfo.new("MakerNote",[7],0), 
    445                 0x9286=>TagInfo.new("UserComment",[7],0), 
    446                 0x9290=>TagInfo.new("SubSecTime",[2],0), 
    447                 0x9290=>TagInfo.new("SubsecTime",[2],0), 
    448                 0x9291=>TagInfo.new("SubSecTimeOriginal",[2],0), 
    449                 0x9291=>TagInfo.new("SubsecTimeOriginal",[2],0), 
    450                 0x9292=>TagInfo.new("SubSecTimeDigitized",[2],0), 
    451                 0x9292=>TagInfo.new("SubsecTimeDigitized",[2],0), 
    452                 0xa000=>TagInfo.new("FlashPixVersion",[7],4), 
    453                 0xa001=>TagInfo.new("ColorSpace",[3],1), 
    454                 0xa002=>TagInfo.new("ExifImageWidth",[3,9],1), 
    455                 0xa003=>TagInfo.new("ExifImageHeight",[3,9],1), 
    456                 0xa004=>TagInfo.new("RelatedSoundFile",[2],0), 
    457                 0xa005=>TagInfo.new("InteroperabilityIFDPointer",[4],1), 
    458                 0xa20b=>TagInfo.new("FlashEnergy",[5],1), 
    459                 0xa20c=>TagInfo.new("SpatialFrequencyResponse",[3],1), 
    460                 0xa20e=>TagInfo.new("FocalPlaneXResolution",[5],1), 
    461                 0xa20f=>TagInfo.new("FocalPlaneYResolution",[5],1), 
    462                 0xa210=>TagInfo.new("FocalPlaneResolutionUnit",[3],1), 
    463                 0xa214=>TagInfo.new("SubjectLocation",[3],1), 
    464                 0xa215=>TagInfo.new("ExposureIndex",[5],1), 
    465                 0xa217=>TagInfo.new("SensingMethod",[3],1), 
    466                 0xa300=>TagInfo.new("FileSource",[7],1), 
    467                 0xa301=>TagInfo.new("SceneType",[7],1), 
    468                 0xa302=>TagInfo.new("CFAPattern",[7],0) 
    469             } 
    470             TAG_NAME.freeze 
    471              
    472             DIRENT_SIZE=12  # tag(2bytes)+format(2bytes)+ 
    473                             #    data_num(4bytes)+data(4bytes) 
    474  
    475             FORMAT_NAME=[nil, 
    476                 'ubyte', 
    477                 'ascii', 
    478                 'ushort', 
    479                 'ulong', 
    480                 'urational', 
    481                 'byte', 
    482                 'undefined', 
    483                 'short', 
    484                 'long', 
    485                 'rational', 
    486                 'float', 
    487                 'double'] 
    488             FORMAT_NAME.freeze 
    489  
    490             FORMAT_SIZE=[nil, 
    491