Page Count of a .PS by color or B&W

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jeffny
Posts: 2
Joined: 2011-01-28T12:57:31-07:00
Authentication code: 8675308

Page Count of a .PS by color or B&W

Post by jeffny »

I need to be able to determine the page count ( through an automated script ) of a .PS file, but to make it challenging I need a count of Black & White pages and a count of color pages.

Was hoping someone had done this through imagemagik and prevent me from digging through and learning Postscript at the inerpreter level. Something I want to avoid at all costs.

Can anyone help?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Page Count of a .PS by color or B&W

Post by fmw42 »

you will likely need to write a script to output each page, then test the color statistics on each page to see if (r=g=b for grayscale) from the verbose information (identify -verbose info: ...) or check the type (bilevel, grayscale, truecolor).
jeffny
Posts: 2
Joined: 2011-01-28T12:57:31-07:00
Authentication code: 8675308

Re: Page Count of a .PS by color or B&W

Post by jeffny »

When you say output each page, you mean to a pdf I presume?

Will the Indentify command work on a postscript, or do I have to use PDF? ( or another format ).

Unfortunately I really need a way to rip this information from a .ps without having to rip (or output) individual pages. Looking to do this on a mass scale as things are printed in bulk.

Thanks for the help regardless.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Page Count of a .PS by color or B&W

Post by fmw42 »

Only other help I can give is to refer you to the following:

http://www.imagemagick.org/Usage/formats/#ps
http://www.imagemagick.org/Usage/formats/#pdf
Post Reply