Skip to content

Instantly share code, notes, and snippets.

@willcosgrove
Created March 24, 2012 23:38
Show Gist options
  • Save willcosgrove/2189130 to your computer and use it in GitHub Desktop.
Save willcosgrove/2189130 to your computer and use it in GitHub Desktop.
NDE tif -> jpg
source 'http://rubygems.org'
gem 'rmagick', '~> 2.13.1'
gem 'listen', '~> 0.3.3'
require 'rmagick'
require 'listen'
Listen.to('photos/', filter: /.*\.tif/, latency: 5) do |modified, added, removed|
added.each do |new_file|
file = Magick::Image.read(new_file).first
file.format = "JPG"
file.write(new_file.gsub(/(.*)\.tif/, '\1.jpg'))
File.delete(new_file)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment