Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added -s (square) flag to bin/image_science_thumb

[git-p4: depot-paths = "//src/image_science/dev/": change = 4612]
  • Loading branch information...
commit 670a4ad7529c77d47b52fe48ef5b14b69e34f9f8 1 parent 3a9ee7c
@zenspider zenspider authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 bin/image_science_thumb
View
8 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)
Please sign in to comment.
Something went wrong with that request. Please try again.