Thank you!
P.S. I'm having some trouble with the broken tables of contents and with broken scaling.
A quick test shows that k2pdfopt -mode copy -n -toc- can cut the table of contents, but not correct the scaling. A Quartz filter can cut and correct, but it's platform-specific and doubles up the text. MuTool Clean can't cut or correct these. Printing to a new pdf should have much the same effect as running through a Quartz filter.
P.P.S. Also running Mutool clean -d -s -z at the end of the process scrambles some text by writing one line over another. But -g -g -g doesn't seem to cause trouble. Known bug with -s:
https://bugs.ghostscript.com/show_bug.cgi?id=702715
P.P.P.S. Removing text from the image pages is hit-and-miss. I suspect k2 is starting before gs has finished. So I am looking at restructuring the script to (a) run a Quartz filter at the beginning, even if it's Mac-specific, (b) then run the Ghostscript stages, (c) then cpdf and k2, and (d) finally run qpdf.