#!/usr/bin/perl -w # Copyright © 2001 by Julian Fong . All rights reserved. # # Permission to use, copy, modify, distribute, and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear in all copies and # that both that copyright notice and this permission notice appear in # supporting documentation. No representations are made about the # suitability of this software for any purpose. It is provided "as # is" without express or implied warranty. # # giflet: create minimal 1x1 gifs for spacing in HTML documents unless (@ARGV == 4) { die "Usage: giflet red green blue filename\n" } open (FILE, ">$ARGV[3]") || die "Unable to open $ARGV[3]: $!\n"; binmode (FILE); syswrite (FILE, pack("a6vvCCCCCCCCCCvvvvCCCCCCC", ("GIF87a"), # 0: signature 1, # 6: width 1, # 8: height 0200, # 10: global color map exists, # 1 bit of color res, 1 bit of pixel 0, # 11: background index 0, # 12: reserved $ARGV[0], # 13: global color map entries $ARGV[1], $ARGV[2], 0, # 16: black 0, 0, 0054, # 19: image separator character ',' 0, # 20: x pos 0, # 22: y pos 1, # 24: width 1, # 26: height 0, # 28: use global color map, # image in sequential order, # BPP=1 bit 2, # 29: Code size - number of bits needed # to represent data, although this # is one bit we must bump it to two 2, # 30: Block byte count: two bytes follow 0104, 0001, # 31: break into 3 bit words: # 100 clear code # 000 data # 101 clear code + 1 (End Of Information) # 000.. padding 0, # 33: zero byte count - terminate compression 0073 # 34: end character ';' ), 35); close(FILE);