Skip to content

Instantly share code, notes, and snippets.

@mattak
Created April 9, 2014 01:32
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 mattak/10217301 to your computer and use it in GitHub Desktop.
Save mattak/10217301 to your computer and use it in GitHub Desktop.
convert size of image
#!/usr/bin/env ruby
if ARGV.size < 1
puts "usage: <stdin list of files> | convertsize.rb <size>"
exit 0
end
STDIN.each do |line|
line.chomp!
src = line
tmp = line.sub(/^(.+)\.([^\.]+)$/) { |e| "#{$1}_tmp_.#{$2}" }
puts "convert -geometry #{ ARGV[0] } #{src} #{tmp}; rm #{src}; mv #{tmp} #{src}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment