Using GhostScript to compress PDF

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \
   -dNOPAUSE -dBATCH -dColorImageResolution=150 \
   -sOutputFile=output.pdf input.pdf