Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve EXIF information of an image in Rails

Tags:

I am using Rails paperclip for displaying the images in my page. I want to know how to retrieve EXIF information of an image(like dimensions, camera model,height,width., etc).Can any one help me out???

Thanks!!!

like image 380
Rukmangathan Govindarajan Avatar asked Aug 07 '12 05:08

Rukmangathan Govindarajan


People also ask

How do I find the EXIF data on a photo?

Using Windows, you can see whether a photo has Exif data attached to it by right-clicking on the file, selecting Properties, and checking under the Details tab. You can also use this menu to remove most Exif data, including location information, by clicking Remove Properties and Personal Information.

Where do I find the EXIF data?

If you're using a Windows PC, right click the file and select 'Properties'. This will then display some of the EXIF data. If you're using a Mac, then right click and select 'Get Info'. These options won't show you all of the EXIF data though, but it'll show you the key bits such as settings used.

What is EXIF Extractor?

Details. Retrieve Exif Data from image binary data. This extension can be used in page or logic actions, to retrieve stored Exif data from an image. The image binary can be presented as a parameter to one of the functions in the XIF.


1 Answers

Did you give exifr gem a try? From the documentation

EXIFR::JPEG.new('IMG_6841.JPG').width               # => 2272 EXIFR::JPEG.new('IMG_6841.JPG').height              # => 1704 EXIFR::JPEG.new('IMG_6841.JPG').exif?               # => true EXIFR::JPEG.new('IMG_6841.JPG').model               # => "Canon PowerShot G3" EXIFR::JPEG.new('IMG_6841.JPG').date_time           # => Fri Feb 09 16:48:54 +0100 2007 EXIFR::JPEG.new('IMG_6841.JPG').exposure_time.to_s  # => "1/15" EXIFR::JPEG.new('IMG_6841.JPG').f_number.to_f       # => 2.0 
like image 184
Kulbir Saini Avatar answered Dec 20 '22 19:12

Kulbir Saini