At 02:58 AM 7/5/2006, Antoine wrote:
>I need to find out whether a particular page in a pdf file has colour
>in it. We need to be able to analyse files to see whether they need to
>be printed on a b&w-only or colour capable copier.
If that is the only criteria, then you can cheat pretty easily.
>The idea I had was to export to an image file format (probably using
>ghostscript or something similar) and then analyse that with an image
>processing tool.
That should be fine for your case. Export to an RGB-based
format such as PNG or BMP, then read that image back in (with
something like JAI) and simply "walk the pixels". If all three
values are equal (R == G == B) then it's a black/white/gray pixel
otherwise it's color. I would start by assuming B/W/G and break when
you find the first color.
NOTE: you may choose to let some "variant" apply (like they
don't have to be mathematically equal, but equivalent (eg. 255, 254, 253).
>Any free or commercial products anyone knows of are all welcome.
There are better solutions than Ghostscript for this -
either native Java-renderers such as Multivalent or JPEDAL, or
commercial quality solutions such as PSServices
(http://www.apago.com) with a native Java interface.
Leonard
---------------------------------------------------------------------------
Leonard Rosenthol <mailto:[EMAIL PROTECTED]>
Chief Technical Officer <http://www.pdfsages.com>
PDF Sages, Inc. 215-938-7080 (voice)
215-938-0880 (fax)
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions