psfindpages reads PostScript from standard input and shows which pages are gray/color. You can then use displayed values as arguments of the psselect "-p" option. The command internally calls ghostscript to render each page and to determine whether it is gray/color.
The command line options are:
psfindpages [OPTION]... -g, --gs=GS use GS as the command name of ghostscript (default gs). -t, --type=TYPE use TYPE (c, g, or cg) to determine which types of pages to be shown (default: cg). -h, --help display this help and exit. -v, --version output version information and exit.
Example usages are as follows:
# show both color and gray pages bash$ psfindpages < paper.ps 30,59,79-80 1-29,31-58,60-78,81-88 # show color pages bash$ psfindpages -t c < paper.ps 30,59,79-80 # show gray pages bash$ psfindpages -t g < paper.ps 1-29,31-58,60-78,81-88 # get two ps files based on colors bash$ psselect -p`psfindpages -t c < paper.ps` < paper.ps > paper-color-part.ps bash$ psselect -p`psfindpages -t g < paper.ps` < paper.ps > paper-gray-part.ps # the faster way bash$ set `psfindpages < paper.ps` bash$ psselect -p$1 < paper.ps > paper-color-part.ps bash$ psselect -p$2 < paper.ps > paper-gray-part.ps
GNU General Public License (GPL).
Koji Nakamaru