Created
March 16, 2014 11:29
-
-
Save XORwell/9581860 to your computer and use it in GitHub Desktop.
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 | |
# Requirements: imagemagick, ghostscript, pdftk | |
############################################# | |
# create pdf for each png | |
############################################# | |
for image in *.png; do | |
filename="${image%%.*}".pdf | |
convert $image $filename | |
done | |
############################################# | |
# Convert image files (in reversed order) into one PDF and use ghostscript to shrink the filesize | |
############################################# | |
convert img_* -reverse output.pdf #for black/white add: -colorspace Gray | |
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=output-shrinked.pdf output.pdf | |
############################################# | |
# reverse page order | |
############################################# | |
pdftk in.pdf cat end-1 output out.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment