just use threads
save images in a circular buffer and generate gifs on demand