Skip to content

Instantly share code, notes, and snippets.

@janosh
Last active August 9, 2020 14:53
Show Gist options
  • Save janosh/cb40f691e26f324ada59b8f6ea388a47 to your computer and use it in GitHub Desktop.
Save janosh/cb40f691e26f324ada59b8f6ea388a47 to your computer and use it in GitHub Desktop.
Bash script that accepts a directory as its single argument and creates small PNG previews of the first page of all PDFs using ImageMagick. Applies to PDFs in given directory and its subdirectories.
#!/bin/bash
find $1 -type f -iname "*.pdf" -exec sh -c 'convert -density 100 -flatten "$1"[0] "$1".png' x {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment