gifsicle — animierte GIFs erstellen, optimieren und bearbeiten

Praxis-Guide zu gifsicle: animierte GIFs an der Kommandozeile erstellen, optimieren, Frames bearbeiten und die Dateigröße verkleinern.

gifsicle ist das Schweizer Taschenmesser für GIFs auf der Kommandozeile: Damit erstellst, optimierst und bearbeitest du animierte GIFs, extrahierst oder löschst einzelne Frames, änderst Timing und Schleifenverhalten und drückst die Dateigröße mit -O3, --colors und --lossy spürbar nach unten. Achte dabei auf zwei Dinge: --lossy arbeitet verlustbehaftet, und --batch (-b) bearbeitet Dateien direkt in-place – das Original wird dabei überschrieben. Lege darum vorab ein Backup an oder schreibe das Ergebnis in eine separate Ausgabedatei.

Grundlagen

gifsicle <input.gif> -o <output.gif> — GIF lesen und schreiben (einfache Kopie).

gifsicle animation.gif -o copy.gif

gifsicle -I <input.gif> — Informationen zu einem GIF anzeigen (Frames, Abmessungen, Farben).

gifsicle -I animation.gif

gifsicle --info --color-info <input.gif> — Ausführliche Infos inklusive Farbtabelle und Frame-Daten anzeigen.

gifsicle --info --color-info animation.gif

gifsicle --explode <input.gif> — Alle Frames als einzelne GIF-Dateien extrahieren.

gifsicle --explode animation.gif

gifsicle <input.gif> '#0' -o <output.gif> — Einen einzelnen Frame extrahieren (0-basiert).

gifsicle animation.gif '#0' -o first-frame.gif

Optimierung

gifsicle -O3 <input.gif> -o <output.gif> — Maximale Optimierung (beste Kompression, am langsamsten).

gifsicle -O3 animation.gif -o optimized.gif

gifsicle -O2 <input.gif> -o <output.gif> — Standard-Optimierung (gute Balance aus Tempo und Größe).

gifsicle -O2 animation.gif -o optimized.gif

gifsicle -O3 --lossy=<n> <input.gif> -o <output.gif> — Verlustbehaftete Kompression für deutlich kleinere Dateien (n = 30–200, höher = kleiner).

gifsicle -O3 --lossy=80 animation.gif -o small.gif

gifsicle --colors <n> <input.gif> -o <output.gif> — Farbpalette reduzieren (2–256 Farben).

gifsicle --colors 64 animation.gif -o reduced.gif

gifsicle --color-method median-cut --colors <n> <input.gif> -o <output.gif> — Farben mit dem Median-Cut-Verfahren reduzieren (bessere Qualität).

gifsicle --color-method median-cut --colors 128 animation.gif -o reduced.gif

gifsicle -O3 --lossy=80 --colors 128 <input.gif> -o <output.gif> — Verlustbehaftete Kompression mit Farbreduktion für maximale Einsparung kombinieren.

gifsicle -O3 --lossy=80 --colors 128 animation.gif -o tiny.gif

Größe ändern & zuschneiden

gifsicle --resize <width>x<height> <input.gif> -o <output.gif> — Auf exakte Abmessungen skalieren.

gifsicle --resize 320x240 animation.gif -o small.gif

gifsicle --resize-fit <width>x<height> <input.gif> -o <output.gif> — In die Abmessungen einpassen (Seitenverhältnis bleibt erhalten).

gifsicle --resize-fit 400x300 animation.gif -o fitted.gif

gifsicle --resize-width <width> <input.gif> -o <output.gif> — Auf eine bestimmte Breite skalieren (Höhe automatisch).

gifsicle --resize-width 320 animation.gif -o resized.gif

gifsicle --resize-height <height> <input.gif> -o <output.gif> — Auf eine bestimmte Höhe skalieren (Breite automatisch).

gifsicle --resize-height 200 animation.gif -o resized.gif

gifsicle --scale <factor> <input.gif> -o <output.gif> — Um einen Faktor skalieren (z. B. 0.5 für halbe Größe).

gifsicle --scale 0.5 animation.gif -o half.gif

gifsicle --crop <x>,<y>+<width>x<height> <input.gif> -o <output.gif> — Einen Bereich aus der Animation ausschneiden.

gifsicle --crop 10,10+200x150 animation.gif -o cropped.gif

gifsicle --crop-transparency <input.gif> -o <output.gif> — Transparente Ränder rund um das Bild entfernen.

gifsicle --crop-transparency animation.gif -o trimmed.gif

Frames bearbeiten

gifsicle <input.gif> '#0-9' -o <output.gif> — Einen Bereich von Frames extrahieren.

gifsicle animation.gif '#0-9' -o first10.gif

gifsicle <input.gif> '#0' '#2' '#4' -o <output.gif> — Bestimmte Frames extrahieren.

gifsicle animation.gif '#0' '#5' '#10' -o selected.gif

gifsicle --delete '#<n>' <input.gif> -o <output.gif> — Einen bestimmten Frame löschen.

gifsicle --delete '#0' animation.gif -o no-first.gif

gifsicle --delete '#<start>-<end>' <input.gif> -o <output.gif> — Einen Bereich von Frames löschen.

gifsicle --delete '#5-10' animation.gif -o shorter.gif

gifsicle <a.gif> <b.gif> -o <output.gif> — Zwei Animationen aneinanderhängen.

gifsicle intro.gif main.gif -o combined.gif

gifsicle --merge <a.gif> <b.gif> -o <output.gif> — Frames aus mehreren GIFs zu einer Animation zusammenführen.

gifsicle --merge part1.gif part2.gif part3.gif -o full.gif

gifsicle --reverse <input.gif> -o <output.gif> — Frame-Reihenfolge umkehren (rückwärts abspielen).

gifsicle --reverse animation.gif -o reversed.gif

Timing & Schleifen

gifsicle --delay <ticks> <input.gif> -o <output.gif> — Verzögerung für alle Frames festlegen (in 1/100 Sekunde).

gifsicle --delay 10 animation.gif -o fast.gif

gifsicle '#0' --delay <ticks> '#1-' <input.gif> -o <output.gif> — Unterschiedliche Verzögerung für ersten Frame und Rest festlegen.

gifsicle animation.gif '#0' --delay 100 '#1-' --delay 5 -o custom.gif

gifsicle --loopcount=<n> <input.gif> -o <output.gif> — Schleifenanzahl festlegen (0 = unendlich, 1 = einmal abspielen).

gifsicle --loopcount=0 animation.gif -o looping.gif

gifsicle --no-loopcount <input.gif> -o <output.gif> — Schleife entfernen (einmal abspielen und stoppen).

gifsicle --no-loopcount animation.gif -o once.gif

Transformieren

gifsicle --rotate-90 <input.gif> -o <output.gif> — Um 90 Grad im Uhrzeigersinn drehen.

gifsicle --rotate-90 animation.gif -o rotated.gif

gifsicle --rotate-180 <input.gif> -o <output.gif> — Um 180 Grad drehen.

gifsicle --rotate-180 animation.gif -o flipped.gif

gifsicle --rotate-270 <input.gif> -o <output.gif> — Um 270 Grad drehen (90 Grad gegen den Uhrzeigersinn).

gifsicle --rotate-270 animation.gif -o rotated.gif

gifsicle --flip-horizontal <input.gif> -o <output.gif> — Horizontal spiegeln.

gifsicle --flip-horizontal animation.gif -o mirrored.gif

gifsicle --flip-vertical <input.gif> -o <output.gif> — Vertikal spiegeln.

gifsicle --flip-vertical animation.gif -o flipped.gif

Typische Anwendungsfälle

gifsicle -O3 --lossy=80 --resize-fit 480x360 --colors 128 <input.gif> -o <output.gif> — Fürs Web optimieren: skalieren, Farben reduzieren, verlustbehaftete Kompression.

gifsicle -O3 --lossy=80 --resize-fit 480x360 --colors 128 large.gif -o web.gif

gifsicle -b -O3 *.gif — Alle GIFs stapelweise in-place optimieren (-b = Originale überschreiben).

gifsicle -b -O3 *.gif

gifsicle <input.gif> '#0-' '#-2-1' -o <output.gif> — Eine Ping-Pong-Schleife (Boomerang) erzeugen.

gifsicle animation.gif '#0-' '#-2-1' -o boomerang.gif

convert -delay 10 frames/*.png gif:- | gifsicle -O3 --lossy=80 -o <output.gif> — Optimiertes GIF aus PNG-Frames erzeugen (ImageMagick-und-gifsicle-Pipeline).

convert -delay 10 frames/*.png gif:- | gifsicle -O3 --lossy=80 -o animation.gif

Fazit

gifsicle gehört in jede Werkzeugkiste, wenn animierte GIFs klein und schnell sein sollen – für den Alltag reichen meist -O3, --colors und --lossy in Kombination mit --resize-fit. Behalte aber im Kopf, dass --lossy Bildinformationen unwiderruflich verwirft und sich die Qualität bei hohen Werten sichtbar verschlechtert. Besonders heikel ist --batch (-b): Es schreibt das Ergebnis direkt in die Originaldatei zurück, ein Fehlversuch lässt sich dann nicht mehr rückgängig machen. Arbeite im Zweifel immer mit einer separaten Ausgabedatei (-o) oder einem Backup und prüfe das Ergebnis, bevor du Originale ersetzt.

Verwandte Kommandos

  • convert – ImageMagick-Werkzeug zum Konvertieren und Bearbeiten von Bildern
  • optipng – verlustfreier PNG-Optimierer
  • pngquant – verlustbehaftete PNG-Kompression mit reduzierter Palette