Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created May 24, 2016 21:29
Show Gist options
  • Select an option

  • Save jamesmichiemo/7a09fc47af0ba3ace653796fd9a60114 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmichiemo/7a09fc47af0ba3ace653796fd9a60114 to your computer and use it in GitHub Desktop.
batch rotate images with imagemagick
Dir.glob("**/*.jpg").each do |filename|
new_filename = File.join(
File.dirname(filename),
"#{File.basename(filename, ".jpg")}-180.jpg")
`convert "#{filename}" -rotate 180 "#{new_filename}"`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment