#!/usr/local/bin/ruby # # ./image_newfromgd.rb > image_newfromgd.gif require "GD" file = open("image_newfromgd.gd", "rb") im = GD::Image.newFromGd(file) file.close # allocate some colors white = im.colorAllocate(255,255,255) black = im.colorAllocate(0,0,0) red = im.colorAllocate(255,0,0) green = im.colorAllocate(0,255,0) blue = im.colorAllocate(0,0,255) yellow = im.colorAllocate(255,250,205) im.gif STDOUT