Permalink
Browse files

Added -s (square) flag to bin/image_science_thumb

[git-p4: depot-paths = "//src/image_science/dev/": change = 4612]
  • Loading branch information...
1 parent 3a9ee7c commit 670a4ad7529c77d47b52fe48ef5b14b69e34f9f8 @zenspider zenspider committed Feb 19, 2009
Showing with 6 additions and 2 deletions.
  1. +6 −2 bin/image_science_thumb
@@ -1,4 +1,6 @@
-#!/usr/local/bin/ruby -w
+#!/usr/local/bin/ruby -ws
+
+$s ||= false
abort "#{File.basename $0} max_length files..." unless ARGV.size > 1
@@ -7,11 +9,13 @@ require 'image_science'
max_length = ARGV.shift.to_i
+msg = $s ? :cropped_thumbnail : :thumbnail
+
ARGV.each do |file|
begin
result = ImageScience.with_image file do |img|
begin
- img.thumbnail(max_length) do |thumb|
+ img.send(msg, max_length) do |thumb|
# add _thumb and switch from gif to png. Really. gif just sucks.
out = file.sub(/(\.[^\.]+)$/, '_thumb\1').sub(/gif$/, 'png')
thumb.save(out)

0 comments on commit 670a4ad

Please sign in to comment.