Created
February 26, 2017 22:08
-
-
Save trumant/89a732feb3f4318f39d2e415dbc389d4 to your computer and use it in GitHub Desktop.
Exif processing with Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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