Script Directory

Convert your gif to a highres Video (mp4)

#!/bin/bash

# Check if input file is provided
if [ "$#" -ne 1 ]; then
    echo "Usage: $0 <input.gif>"
    exit 1
fi

input="$1"
output="${input%.*}.mp4"

# Loop the GIF 5 times, scale up by 10x (using nearest neighbor for hard edges), and convert to MP4
ffmpeg -i "$input" -filter_complex "[0:v]split[a][b];[a]palettegen[p];[b][p]paletteuse,scale=10*iw:10*ih:flags=neighbor" -loop 5 -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p "$output"

echo "Output: $output"

Steinberg-Floyd Dithering with Gifsicle

gifsicle -O3 --colors 6 --dither turmoil.gif -o output.gif

Steinberg-Floyd Dithering with ImageMagick

convert input.gif -dither Steinberg -colors 4 -layers Optimize output.gif

Convert to Black and White

gifsicle --colors 256 --use-col=gray input.gif -o output.gif

Drop every second Frame

This doubles the speed and cuts the file size by 50%.

Hard Conversion to Black and White

gifsicle --use-colormap bw flip2.gif -o output.gif

Reduce Colors and apply Dithering

gifsicle --colors=64 --dither input.gif -o output.gif

Change Speed

gifsicle --delay=TIME INPUT_GIF -o OUTPUT_GIF

Generate an animated Gif from single Gif frames

gifsicle --delay=10 --loop out/*.gif > output.gif

With dithering and color setting:

gifsicle --delay=2 --colors 3 --dither --loop out/*.gif > output.gif

Generate a Gif from a Sequence of PNG files

ffmpeg -i %03d.png out.gif