Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kingink committed Dec 16, 2011
0 parents commit c8886be
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.rdoc
@@ -0,0 +1,5 @@
= bibimbap is a silly little image resizer

== Note

Basically I am tippsy and I want to play with rmagick
27 changes: 27 additions & 0 deletions bibimbap.rb
@@ -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)
Binary file added cat_in_a_bowl.jpg
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.