Exercise

  1. In my public directory, there's a gif called ``welc.gif''. Copy it into your public_html directory. Go into that directory and take a look at this picture with Xv by typing xv welc.gif &. You should see a picture that has the word ``Welcome'' on it. You may incorporate this picture into your home page. (Perhaps you want to put your name after it to make it look like ``Welcome to Foo Bar's Home Page'')
  2. Add the line <img src="welc.gif"> to one of your HTML documents and look at it with Netscape. You should see that the white background of the picture is visible to the browser. Wouldn't it look nice if we didn't have that white background showing through?
  3. Let's make the white stuff transparent so that your home page's background shows through instead. Go back to the Xv window and hold down the middle mouse button on some white area of the picture. You should see the coordinates of the pixel as well as the red, blue, green (RGB) color values. In this case, the white pixel has a RGB value of 255,255,255. Note those numbers.
  4. Now use giftrans to make the white pixels transparent. There is a copy of giftrans in
    /dept/acm/packages/giftrans/1.11.1/sgi_53/bin/giftrans
    and it should work. If you later find yourself logged onto a SUN workstation or an IBM, then sgi_53 should be changed appropriately. Do an ls in the

    /dept/acm/packages/giftrans/1.11.1/

    directory to find out the other operating systems supported. For example, if you are logged onto an IBM, then change sgi_53 to rs_aix32 or rs_aix41. If you are on a SUN machine, then use sun4c_411 or sun4m_412. I know there's a better way to do it, but for now that'll work. So, go into my public directory and copy welc.gif to your account then cd back into your account. Then type :

    /dept/acm/packages/giftrans/1.11.1/sgi_53/bin/giftrans -l welc.gif

    You should have gotten the following output :

    Global Color Table:
            Color 0: Red 255, Green 255, Blue 255, #ffffff (white, gray100, grey100)
            Color 1: Red 0, Green 0, Blue 255, #0000ff (blue, blue1)

    OK, remember the 255,255,255 stuff we got from Xv ? Well, according to the output from giftrans, that's color 0. Now type :

    /dept/acm/packages/giftrans/1.11.1/sgi_53/bin/giftrans -o welc_trans.gif -t 0 welc.gif

    The filename following the ''-o'' is the output file and the number following the ''-t'' is the index of the color we want to make transparent. The last thing is the name of the picture we want to make transparent. So, what we did is made color 0 in ''welc.gif'' transparent and wrote the resulting picture to ''welc_trans.gif''.