Created
March 4, 2018 09:52
-
-
Save kampfgnu/fd93208b57f03b7f9e23f3b4746c5a1f to your computer and use it in GitHub Desktop.
convert vector pdf to iOS image assets
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 -e | |
# convert vector pdf to iOS image assets | |
# copy this script to the folder where the pdf files live and run "./convertPDFToPNG3x.sh" in terminal. | |
# this will generate [filename]@3x.png, [filename]@2x.png and [filename].png images in the same folder | |
# Ensure we're running in location of script. | |
cd "`dirname $0`" | |
for f in *; do | |
if [[ $f == *.pdf ]]; | |
then | |
convert -density 216 "$f" "${f//.pdf/@3x.png}" | |
convert -density 144 "$f" "${f//.pdf/@2x.png}" | |
convert -density 72 "$f" "${f//.pdf/.png}" | |
fi | |
done | |
echo "Complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment