Change PDF image quality with gs

Compress images in a pdf using ghostscript (gs)

gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/### -sOutputFile=compressed.pdf input.pdf

Where PDFSETTINGS can be set to

/screen   ("Screen Optimized" - 72 dpi images)
/ebook    ("eBook" - 150 dpi images)
/printer  ("Print Optimized" - 300 dpi images)
/prepress ("Prepress Optimized" - color preserving, 300 dpi imgs)
/default  (useful across a wide variety of uses)

Rule of thumb: ebook is ok for optimizing most documents, screen for texts with non-significant images, printer for high-quality files.