Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit c8886be3a6c8158b505ca2f0a43a893afed7ec65 @kingink committed Dec 16, 2011
Showing with 32 additions and 0 deletions.
  1. +5 −0 README.rdoc
  2. +27 −0 bibimbap.rb
  3. BIN cat_in_a_bowl.jpg
@@ -0,0 +1,5 @@
+= bibimbap is a silly little image resizer
+
+== Note
+
+Basically I am tippsy and I want to play with rmagick
@@ -0,0 +1,27 @@
+require 'rubygems'
+require 'rmagick'
+include Magick
+
+unless ARGV[0]
+ puts "\n\n\nYou need to specify a filename: bibimbap.rb <filename> [size]\nSize is optional and will defualt to 400\n\n\n"
+ exit
+end
+
+img = Magick::Image.read(ARGV[0]).first
+width = nil
+height = nil
+
+img.change_geometry('400x400') do |cols, rows, img|
+ img.resize!(cols, rows)
+ width = cols
+ height = rows
+end
+
+file_name = "#{width}x#{height}_#{ARGV[0]}"
+
+if File.exists?(file_name)
+ puts "File already exists. Unable to write file."
+ exit
+end
+
+img.write(file_name)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c8886be

Please sign in to comment.