Lo hago con GhostScript
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -dColorImageResolution=150 -sOutputFile=salida.pdf entrada.pdf
En windows he tenido que usar gswin64c.exe
Lo hago con GhostScript
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -dColorImageResolution=150 -sOutputFile=salida.pdf entrada.pdf
En windows he tenido que usar gswin64c.exe
$ rdfind -deleteduplicates true carpeta_con_fotos
$ find carpeta_con_fotos -iname "Thumbs.db" -exec rm -f {} \;
$ find carpeta_con_fotos -type d -empty -exec rmdir '{}' \;