Version 4 of .gif color dot

Updated 2002-10-09 11:48:20

Explain how. Explain why.

Primitive:

    proc make_color_dot color {
        return \x47\x49\x46\x38\x37\x61\x01\x00\x01\x00\x91\x00$color\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3b\x00
    }


    proc write_color_dot {color filename} {
        set fp [open $filename w]
        puts -nonewline $fp [make_color_dot $color]
        close $fp
    }


    write_color_dot \x00\x00\xff\x00 /tmp/gif/green.gif

[Write up Tk example for simply putting color on PhotoImage.]


Pythonic expression of same:

     template = [71, 73, 70, 56, 57, 97, 1, 0, 1, 0, 128, 0, 0, 255, 255,
                 255,
                 0, 0, 0, 33, 249, 4, 1, 0, 0, 0, 0, 44, 0, 0, 0, 0, 1,
                 0, 1,
                 0, 0, 2, 2, 68, 1, 0, 59]
     if color:
         rgb = [63, 127, 255] # will be calculated later
         template[13:16] = rgb
         template[22] = 0 # remove transparency    

Modern Web programming deprecates spacer gif-s in favor of CSS positioning.