Skip to content

Instantly share code, notes, and snippets.

@insertish
Last active April 21, 2023 10:47
Show Gist options
  • Save insertish/e52d7b154ec8ed90e3ac48006d3a8956 to your computer and use it in GitHub Desktop.
Save insertish/e52d7b154ec8ed90e3ac48006d3a8956 to your computer and use it in GitHub Desktop.
#!/bin/fish
# convert the PDF into a sequence of images
# pick input filename
set PDF_NAME abc.pdf
# you may need to experiment with density to find the correct resolution
set DENSITY 300
convert -density $DENSITY -quality 100 $PDF_NAME seq.png
# convert the sequence of images into a GIF
# rate is in hz (i.e. 0.5/s = 1 every 2s)
set RATE 0.5
# pick the start slide (minus 1)
set START_SLIDE 8
# number of slides to include
set NUM_SLIDES 13
ffmpeg -f image2 -start_number $START_SLIDE -r $RATE -lavfi palettegen=stats_mode=single[pal],[0:v][pal]paletteuse=new=1 -i seq-%d.png -frames:v $NUM_SLIDES out.gif
#!/bin/bash
# convert the PDF into a sequence of images
# pick input filename
PDF_NAME=abc.pdf
# you may need to experiment with density to find the correct resolution
DENSITY=300
convert -density $DENSITY -quality 100 $PDF_NAME seq.png
# convert the sequence of images into a GIF
# rate is in hz (i.e. 0.5/s = 1 every 2s)
RATE=0.5
# pick the start slide (minus 1)
START_SLIDE=8
# number of slides to include
NUM_SLIDES=13
ffmpeg -f image2 -start_number $START_SLIDE -r $RATE -lavfi palettegen=stats_mode=single[pal],[0:v][pal]paletteuse=new=1 -i seq-%d.png -frames:v $NUM_SLIDES out.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment