'read_gif(filename)
Reads images from an animated GIF file. Returns the number of images loaded.'

def _read_gif(self, filename):

    if (not PIL_ENABLED):
        return
    elif (not os.path.isfile(filename)):
        return
    pil_img = pil.open(filename)
    pil_img.seek(0)
    pil_images = []
    try:
        while True:
            pil_images.append(pil_img.copy())
            pil_img.seek((pil_img.tell() + 1))
    except EOFError:
        pass
    loaded = 0
    for img in pil_images:
        self.append(Image(img))
        loaded += 1
    return loaded
