Remove / Delete all images from a PDF using Ghostscript or ImageMagick

Viewed 8777

I want to delete / remove all the images in a PDF leaving only the text / font in the PDF with whatever command Line tool possible.

I tried using -dGraphicsAlphaBits=1 in a Ghostscript command but the images are present but like a big pixel.

5 Answers
 gs -o noImages.pdf   -sDEVICE=pdfwrite -dFILTERIMAGE                input.pdf
 gs -o noText.pdf   -sDEVICE=pdfwrite -dFILTERTEXT                 input.pdf
 gs -o noVectors.pdf   -sDEVICE=pdfwrite -dFILTERVECTOR               input.pdf
 gs -o onlyImages.pdf -sDEVICE=pdfwrite -dFILTERVECTOR -dFILTERTEXT  input.pdf
 gs -o onlyText.pdf -sDEVICE=pdfwrite -dFILTERVECTOR -dFILTERIMAGE input.pdf
 gs -o onlyVectors.pdf -sDEVICE=pdfwrite -dFILTERIMAGE  -dFILTERTEXT  input.pdf
Related