Created
April 26, 2012 01:16
-
-
Save zph/2495001 to your computer and use it in GitHub Desktop.
Embed a label in each image based on filename
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 | |
# | |
# Author: tevic@civet.ws | |
# Description: Apply a label at the bottom of each photo in folder | |
# according to filename. | |
# Dependencies: | |
# *nix | |
# Ruby | |
# ImageMagick | |
##################################### | |
# | |
Dir.glob('*').grep(/jpg$/i).each do |file| | |
file_orig = File.expand_path(file) | |
output_name = "#{file.gsub(/\W/, '_')}_labelled.JPG" | |
puts "Working on #{file_orig}" | |
`convert '#{file_orig}' -background seashell3 -pointsize 72 label:'#{file.gsub(/-/, '/').gsub(/\.jpg/i, '')}' -gravity Center -append tmp/#{output_name}` | |
puts "Done with #{file_orig}" | |
end | |
# Increase font size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment