How to extract images from a pdf and reduce their size

  1. Extract the images into a temporary folder. Twiddle with the quality value to reduce the size.

    1
    2
    3
    4
    5
    6
    7
    8
    convert \
    -verbose \
    -density 150 \
    -trim \
    source-pdf-file.pdf
    -quality 50 \
    -sharpen 0x1.0 \
    image-prefix.jpg
  2. Create the pdf back from all the images.

    1
    convert *.jpg output-file.pdf

I am currently working on Zammu which makes Automatic Deployment of static websites to Github Pages very easy. I would love to get your feedback on it, Use the invitation code KHAJA