fps=60000/1001

ffmpeg \
    -r $fps -i "$1.%01d.png" \
    -vf palettegen \
    -y "$1.palette.png" \
&& \
ffmpeg \
    -r $fps -i "$1.%01d.png" \
    -i "$1.palette.png" \
    -lavfi "[0]scale=w=800:h=480:sws_flags=neighbor[scaled];\
            [scaled][1]paletteuse=dither=none" \
    -y "$1.gif"
