# All in MiniExifTool

**URL:** <https://www.ruby-forum.com/t/all-in-miniexiftool/107396>\
**Category:** Ruby\
**Created:** [June 21, 2007, 8:20am UTC](https://www.ruby-forum.com/t/all-in-miniexiftool/107396 "2007-06-21T08:20:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 21, 2007, 8:20am UTC](https://www.ruby-forum.com/t/all-in-miniexiftool/107396/1 "2007-06-21T08:20:14Z")

</div>

I wanted to list all the EXIF data for a photo. Is there a method for  
that? Equivalent to ExifTool:

exiftool -h filepath

Thanks

---

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 21, 2007, 8:46pm UTC](https://www.ruby-forum.com/t/all-in-miniexiftool/107396/2 "2007-06-21T20:46:26Z")

</div>

12 34 schrieb:

> I wanted to list all the EXIF data for a photo. Is there a method for  
> that? Equivalent to ExifTool:
> 
> exiftool -h filepath
> 
> Thanks

You should better ask this at rubyforge:  
[http://rubyforge.org/tracker/?group\_id=2912](http://rubyforge.org/tracker/?group_id=2912)

You can use the method tags, which returns an array of all tags of the  
file.

Here a simple example (no HTML output but this shouldn’t be difficult to  
adapt):

require ‘mini\_exiftool’

photo = MiniExiftool.new ‘file.jpg’

photo.tags.sort.each do |tag|  
puts tag + ': ’ + photo[tag]  
end

Have a look at the API-documentation  
[http://miniexiftool.rubyforge.org/](http://miniexiftool.rubyforge.org/)  
and the turorial  
[http://miniexiftool.rubyforge.org/files/Tutorial.html](http://miniexiftool.rubyforge.org/files/Tutorial.html)

Best regards  
Jan

---

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 22, 2007, 12:05am UTC](https://www.ruby-forum.com/t/all-in-miniexiftool/107396/3 "2007-06-22T00:05:06Z")

</div>

12 34 wrote:

> Jan F. wrote:
> 
> > 12 34 schrieb:
> > 
> > > I wanted to list all the EXIF data for a photo. Is there a method for  
> > > that? Equivalent to ExifTool:
> > > 
> > > exiftool -h filepath
> > > 
> > > Thanks

> > require ‘mini\_exiftool’
> > 
> > photo = MiniExiftool.new ‘file.jpg’
> > 
> > photo.tags.sort.each do |tag|  
> > puts tag + ': ’ + photo[tag]  
> > end
> > 
> > Jan

Forgot to add that this method is better than the exiftool -h, because  
it gives the literal method name. I was having trouble guessing at some  
of them. For example to get “Camera Model Name” is “photo.model.”

---

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 21, 2007, 11:59pm UTC](https://www.ruby-forum.com/t/all-in-miniexiftool/107396/4 "2007-06-21T23:59:54Z")

</div>

Jan F. wrote:

> 12 34 schrieb:
> 
> > I wanted to list all the EXIF data for a photo. Is there a method for  
> > that? Equivalent to ExifTool:
> > 
> > exiftool -h filepath
> > 
> > Thanks
> 
> You should better ask this at rubyforge:  
> [http://rubyforge.org/tracker/?group\_id=2912](http://rubyforge.org/tracker/?group_id=2912)
> 
> You can use the method tags, which returns an array of all tags of the  
> file.
> 
> Here a simple example (no HTML output but this shouldn’t be difficult to  
> adapt):
> 
> require ‘mini\_exiftool’
> 
> photo = MiniExiftool.new ‘file.jpg’
> 
> photo.tags.sort.each do |tag|  
> puts tag + ': ’ + photo[tag]  
> end
> 
> Have a look at the API-documentation  
> [http://miniexiftool.rubyforge.org/](http://miniexiftool.rubyforge.org/)  
> and the turorial  
> [http://miniexiftool.rubyforge.org/files/Tutorial.html](http://miniexiftool.rubyforge.org/files/Tutorial.html)
> 
> Best regards  
> Jan

Thanks, that worked. I changed one line to

puts “#{tag}: #{photo[tag]}”

since it errored to begin with. Maybe a copying error.

I had looked at the docs but I didn’t know what to look for (still  
don’t). I’m not confortable enough with Ruby nomenclature to be able to  
figure out I need a method tags and I don’t see where’d I’d find that in  
the docs and know what it would do.

Thanks

---

<div class="post-metadata">

**Author:** ![mtnbiker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@mtnbiker](https://www.ruby-forum.com/u/mtnbiker)\
**Post date:** [June 22, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/all-in-miniexiftool/107396/5 "2007-06-22T21:31:29Z")

</div>

12 34 wrote:

> I changed one line to
> 
> puts “#{tag}: #{photo[tag]}”
> 
> since it errored to begin with. Maybe a copying error.  
> Sorry, my mistake.

> I had looked at the docs but I didn’t know what to look for (still  
> don’t). I’m not confortable enough with Ruby nomenclature to be able to  
> figure out I need a method tags and I don’t see where’d I’d find that in  
> the docs and know what it would do.  
> You are learning. 🙂  
> So my mistake above has maybe a teaching effect. 😉

Regards  
Jan
