Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using ghostscript to convert postscript to pure black and white.

876 views
Skip to first unread message

sean_n

unread,
May 12, 2008, 11:22:54 PM5/12/08
to
Hello, can someone please provide instructions on how to use
ghostscript to convert postscript into pure black and white? The end
result can be either postscript or pdf. Please provide example, as I
only know the most basic syntax of ps2pdf. What do you get out of
it? You get to be called The MAN! or The WOMAN!

Martin Heller

unread,
May 14, 2008, 7:08:03 AM5/14/08
to
sean_n skrev:

This seem to work on my system. You need an up-to-date version
(it works with GS 8.61) of gs for the Gray
ColorConversionStrategy to be available.

gswin32c.exe -q -dSAFER -dNOPAUSE -sDEVICE#pdfwrite -dBATCH
-sOutputFile#test.pdf -dProcessColorModel#/DeviceGray
-sColorConversionStrategy#Gray test.ps

seannakasone

unread,
May 16, 2008, 7:35:23 PM5/16/08
to
Hello, by pure black and white, i meant no greyscale. The problem is
colored lines when plotted to a black and white printer will produce
greyscale that is too dim to see. Therefore we only want pure black or
white. HP printers have this option, Xerox printers don't. We just
switched our printers to Xerox and are faced with this challenge.


Ken Starks

unread,
May 17, 2008, 9:44:00 PM5/17/08
to
Have you considered using another approach, such as the
Python Imaging Library (PIL).

The python script could be something like:

# ---------------------------------

import Image

# Load and convert to Greyscale to start with
Original = Image.open("Winter.jpg").convert("L")

""" with a threshold of 60, all pixels more than 60
become pure black, others pure white.

Choose threshold by Trial and Error.
"""

threshold = 60
Result=Result.point(lambda i: (i > threshold) * 255)
Result=Result.convert("1")
Result.save("Result2.pdf")

#--------------------------------------

But you are quite likely to hit nasty anti-aliasing problems
unless you do some other image-processing first. Blur,
Line-thickening, anti-aliasing ...

Interactive software might be better, by the way.

Martin Heller

unread,
May 19, 2008, 5:42:57 AM5/19/08
to
seannakasone skrev:

If it is only for printing then use -sDEVICE#psmono and set the
resolution with the -r flag.

0 new messages