visualculture.prototype
clone your own copy | download snapshot

Snapshots | iceberg

No images in this repository’s iceberg at this time

Inside this repository

gif.rb
application/x-ruby

Download raw (597 bytes)

# encoding: UTF-8
# GIF transducer
$:.unshift File.join(File.dirname(__FILE__), "..")
require 'visualculture'

module VC
  module Transducers
    gif = lambda {|blob, size|
      name = blob.compose_path_2(size)
      r = ImageList.new       # ImageLists need initialization before from_blob
      r.from_blob(blob.data)
      geometry = Geometry.new size.to_i, size.to_i, nil, nil, GreaterGeometry
      r.each do |x|
        x.change_geometry! geometry do |h,w,img|
          img.resize! h,w
        end
      end
      r.write name
      name
    }  
    @handlers["image/gif"] = gif
  end
end