def get_exif_by_number(*tag)
      hash = {}
      if tag.length.zero?
        exif_data = self['EXIF:!']
        if exif_data
          exif_data.split("\n").each do |exif|
            tag, value = exif.split('=')
            tag = tag[1, 4].hex
            hash[tag] = value
          end
        end
      else
        get_exif_by_number # ensure properties is populated with exif data
        tag.each do |num|
          rval = self[format('#%04X', num.to_i)]
          hash[num] = rval == 'unknown' ? nil : rval
        end
      end
      hash
    end
def get_exif_by_number(*tag)
      hash = {}
      if tag.length.zero?
        exif_data = self['EXIF:!']
        if exif_data
          exif_data.split("\n").each do |exif|
            tag, value = exif.split('=')
            tag = tag[1, 4].hex
            hash[tag] = value
          end
        end
      else
        get_exif_by_number # ensure properties is populated with exif data
        tag.each do |num|
          rval = self[format('#%04X', num.to_i)]
          hash[num] = rval == 'unknown' ? nil : rval
        end
      end
      hash
    end
Retrieve EXIF data by tag number or all tag/value pairs. The return value is a hash.