Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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