Hier haben Sie ein Beispiel für eine Klasse, die ein animiertes GIF aus verschiedenen Bildern erstellt:
Link
Die Klasse bietet diese Methoden:
class GifSequenceWriter {
public GifSequenceWriter(
ImageOutputStream outputStream,
int imageType,
int timeBetweenFramesMS,
boolean loopContinuously);
public void writeToSequence(RenderedImage img);
public void close();
}
Und auch ein kleines Beispiel:
public static void main(String[] args) throws Exception {
if (args.length > 1) {
// grab the output image type from the first image in the sequence
BufferedImage firstImage = ImageIO.read(new File(args[0]));
// create a new BufferedOutputStream with the last argument
ImageOutputStream output =
new FileImageOutputStream(new File(args[args.length - 1]));
// create a gif sequence with the type of the first image, 1 second
// between frames, which loops continuously
GifSequenceWriter writer =
new GifSequenceWriter(output, firstImage.getType(), 1, false);
// write out the first image to our sequence...
writer.writeToSequence(firstImage);
for(int i=1; i<args.length-1; i++) {
BufferedImage nextImage = ImageIO.read(new File(args[i]));
writer.writeToSequence(nextImage);
}
writer.close();
output.close();
} else {
System.out.println(
"Usage: java GifSequenceWriter [list of gif files] [output file]");
}
}
Meinst du ein animiertes Gif? oder willst du ein großes gif aus ein paar kleineren gifs? Oder möchten Sie ein gif auf einem anderen mit der Transparenz von gif einfügen? – Dariusz
Ich möchte ein animiertes Gif. – user2399314
Dieses [link] (https://github.com/dragon66/icafe/wiki) hat viel mehr Informationen als nur animiertes GIF zu erstellen. – dragon66