Skip to content

Instantly share code, notes, and snippets.

@maakuth
Created November 7, 2015 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maakuth/ec54196bf54e393effd5 to your computer and use it in GitHub Desktop.
Save maakuth/ec54196bf54e393effd5 to your computer and use it in GitHub Desktop.
Shell utility script to compress images into reasonably sized PDFs
#!/bin/sh
if [ $# -eq 0 ]
then
echo "Usage $0 img1.png img2.tif img3.pdf"
echo "Requires ghostscript, imagemagick"
fi
for file in "$@"
do
convert "$file" "$file.pdf"
pdf2ps "$file.pdf"
rm "$file.pdf"
ps2pdf "$file.ps" "${file%.*}.pdf"
rm "$file.ps"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment