Skip to content

Instantly share code, notes, and snippets.

@trumant
Created February 26, 2017 22:08
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 trumant/89a732feb3f4318f39d2e415dbc389d4 to your computer and use it in GitHub Desktop.
Save trumant/89a732feb3f4318f39d2e415dbc389d4 to your computer and use it in GitHub Desktop.
Exif processing with Ruby
#!/usr/bin/env ruby
require "mini_exiftool_vendored"
require 'mini_exiftool'
images_directory = ARGV[0]
puts "Processing images in directory: #{images_directory}"
images_list = Dir.entries(images_directory).reject{ |d| d.start_with?(".") }.reject {|d| !d.end_with?("jpg") }.sort
def update_user_comment(filename, new_user_comment)
photo = MiniExiftool.new(filename)
photo.UserComment = new_user_comment
photo.save
end
images_list.each do |file|
relPath = "#{images_directory}/#{file}"
puts "Updated copyright for: #{relPath}"
update_user_comment(relPath, "Travis Truman")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment