Sha256: 23dd3799dd8da88d311b7907152b42139acb9a10e3f28ebed6845d5c488bdb57

Contents?: true

Size: 725 Bytes

Versions: 28

Compression:

Stored size: 725 Bytes

Contents

#!/usr/local/bin/ruby -ws

$s ||= false

abort "#{File.basename $0} max_length files..." unless ARGV.size > 1

require 'rubygems'
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.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)
        end
      rescue => e
        warn "Exception thumbnailing #{file}: #{e}"
      end
    end
    p file => result
  rescue => e
    warn "Exception opening #{file}: #{e}"
  end
end

Version data entries

28 entries across 28 versions & 8 rubygems

Version Path
g1nn13-image_science-1.2.7 bin/image_science_thumb
g1nn13-image_science-1.2.6 bin/image_science_thumb
g1nn13-image_science-1.2.5 bin/image_science_thumb
g1nn13-image_science-1.2.4 bin/image_science_thumb
g1nn13-image_science-1.2.3 bin/image_science_thumb
stateless-systems-image_science-1.2.2 bin/image_science_thumb
image_science-1.2.1 bin/image_science_thumb
image_science-1.2.0 bin/image_science_thumb