I just happen to have it handy:
# convert all .tif file in a directory to .gif files
# needs Python Image Library (PIL) free from:
# http://www.pythonware.com/products/pil/index.htm
import os
from PIL import Image
# give the directory the TIF files are in
path = 'C:/temp/test/'
# make it the working directory
os.chdir(path)
for file in os.listdir(path):
# assumes '.tif' is lower case
if file.endswith('.tif'):
img = Image.open(file)
# change name *.tif to *.gif
gif_file = file[:-4]+'.gif'
img.save(gif_file)
# indicate progress
print( "%s converted and saved to %s" % (file, gif_file) )