Skip to content

Instantly share code, notes, and snippets.

@sylph01
Created August 2, 2023 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sylph01/ed619007b7877ca45740ed44795fc03b to your computer and use it in GitHub Desktop.
Save sylph01/ed619007b7877ca45740ed44795fc03b to your computer and use it in GitHub Desktop.
require 'exif'
require 'json'
h = {}
Dir.glob('*.JPG') do |fname|
data = Exif::Data.new(File.open(fname))
h[fname] = {
focal_length: data.focal_length.to_i,
iso_speed_ratings: data.iso_speed_ratings,
f_number: data.fnumber.to_f
}
end
File.write('exif_stats.json', h.to_json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment