Skip to content

Instantly share code, notes, and snippets.

@alunny
Created July 12, 2010 18:42
Show Gist options
  • Save alunny/472884 to your computer and use it in GitHub Desktop.
Save alunny/472884 to your computer and use it in GitHub Desktop.
convert image with image_science
#! /usr/bin/ruby
# usage: ruby convert.rb icon.jpg png
require 'rubygems'
require 'image_science'
if ARGV.length == 2
source_file = ARGV.first
target_extension = ARGV.last
target_file = source_file.sub /[\w\d]+$/, target_extension
ImageScience::with_image(source_file) do |img|
img.save(target_file)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment