Last active
August 29, 2015 14:21
-
-
Save rbanick/3b93c0c467eb9286ec6a to your computer and use it in GitHub Desktop.
Quickly flattening an atlas of vector PDFs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This will convert PDF atlases to .pngs and then convert them back to .PDF, now rasterized. | |
# Use this script to flatten PDF exports from QGIS so you can generate thumbnails for the Mapfolio | |
# This script uses imagemagick and ghostscript. | |
# Please note: Ghostscript does not automatically come installed with imagemagick. Run 'brew install gs' to install it. | |
## Atlas Conversion | |
ls -1 *.pdf | parallel convert -density 150 '{}' -quality 90 -alpha remove '{.}.png' | |
ls -1 *.pdf | rm '{}' | |
ls -1 *.png | parallel convert '{}' '{.}.pdf' | |
mkdir ../Flattened_atlas | |
mv *.pdf ../Flattened_atlas | |
echo "Done! Atlas flattened and moved to a new 'Flattened_atlas' folder" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment