Skip to content

Instantly share code, notes, and snippets.

@Coro365
Created November 5, 2018 07:28
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 Coro365/ab9d130fa780724db4a18527e64edfb0 to your computer and use it in GitHub Desktop.
Save Coro365/ab9d130fa780724db4a18527e64edfb0 to your computer and use it in GitHub Desktop.
Delete the lower 14 pixels of the image
path = ARGV[0]
Dir.glob("#{path}/*") do |file|
next unless file.index(/jpeg$|jpg$|png$/)
# get image pixel size
width, hight = `identify -format "%w %h" #{file}`.split(" ")
new_file = File.basename(file) + "-trimed" + File.extname(file)
# trim
puts "convert #{file} -crop #{width}x#{hight}+0-14 #{new_file}"
`convert #{file} -crop #{width}x#{hight}+0-14 #{new_file}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment