Created
January 30, 2022 04:20
-
-
Save williamrowell/f9980b30bbd0779fa035d2f2b3245d21 to your computer and use it in GitHub Desktop.
reduceMPL
This file contains 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
#!/usr/bin/env bash | |
# from https://leancrew.com/all-this/2022/01/reducing-the-size-of-large-pdfs/ | |
# Reduces the size of PDF plots created by Matplotlib. | |
# Assumes that the files to be reduced are named mpl[Something].pdf | |
# and that it's called via | |
# | |
# reduceMPL mpl*.pdf | |
# | |
# The results are a set of smaller files named [Something].pdf | |
# The original files are *not* deleted. | |
for mpl do | |
new=$(cut -c 4- <<< "$mpl") | |
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$new" "$mpl" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment