Last active
August 29, 2015 13:59
-
-
Save detunized/10998857 to your computer and use it in GitHub Desktop.
Prepare images for printing
This file contains hidden or 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 | |
min_width = `identify *.jpg` | |
.split("\n") | |
.map { |i| i[/JPEG (\d+x\d+)/, 1] } | |
.map { |i| i.split "x" } | |
.transpose[0] | |
.map { |i| i.to_i } | |
.min | |
p min_width | |
system "rm -rf print" | |
system "mkdir -p print" | |
Dir["*.jpg"].sort_by { |i| i[/\d+/].to_i }.each_slice(4).each_with_index do |images, index| | |
p images | |
p index | |
system %Q{montage -quality 100% -tile 2x2 -geometry 1920x1920+100+539 #{images.join " "} print/cups-#{index}.jpg} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment