Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
imageopen - mac commandline
#!/usr/bin/env ruby
# imageopen - # for mac, commandline open an image file without needing an extension, recognition via imagemagick
# (brendan o'connor)
require 'fileutils'
f = ARGV[0]
type = %x[identify #{f}].split[1].downcase
tmp = "/tmp/tmp.#{$$}.#{type}"
FileUtils.cp f, tmp
puts "--> #{tmp}"
system "open #{tmp}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.