!7 p { new L images; for (S id : splitAtSpace("#1003635 #1003670")) images.add(loadLibrary(id)); // makes the parent directory File gifFile = prepareProgramFile("animated-speaker.gif"); // grab the output image type from the first image in the sequence BufferedImage firstImage = ImageIO.read(images.get(0)); // create a new BufferedOutputStream with the last argument ImageOutputStream output = fileImageOutputStream(gifFile); // create a gif sequence with the type of the first image, 500 ms // between frames, which loops continuously GifSequenceWriter writer = new GifSequenceWriter(output, firstImage.getType(), 500, true); // Write images writer.writeToSequence(firstImage); for (int i=1; i < l(images); i++) { BufferedImage nextImage = ImageIO.read(images.get(i)); writer.writeToSequence(nextImage); } writer.close(); print("Wrote " + n(l(images), " frame") + " to: " + gifFile.getAbsolutePath()); }