Created
March 24, 2012 23:38
-
-
Save willcosgrove/2189130 to your computer and use it in GitHub Desktop.
NDE tif -> jpg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'http://rubygems.org' | |
| gem 'rmagick', '~> 2.13.1' | |
| gem 'listen', '~> 0.3.3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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