Method: Magick::Image#get_exif_by_number

Defined in:
lib/RMagick.rb

#get_exif_by_number(*tag) ⇒ Object

Retrieve EXIF data by tag number or all tag/value pairs. The return value is a hash.


863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
# File 'lib/RMagick.rb', line 863

def get_exif_by_number(*tag)
    hash = Hash.new
    if tag.length == 0
        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['#%04X' % num.to_i]
            hash[num] = rval == 'unknown' ? nil : rval
        end
    end
    return hash
end