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

how to invert a postscript file

390 views
Skip to first unread message

greg...@my-deja.com

unread,
Jun 1, 1999, 3:00:00 AM6/1/99
to
I've got an image in postscript format that I need to print inverted
(ie: white->black and black->white, not rotated or mirrored). GSview on
the PC doesn't seem to have this ability. Is there a postscript command
to cause a page to print in inverse?

Thanks in advance

Greg Hodgdon


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Rod Dorman

unread,
Jun 3, 1999, 3:00:00 AM6/3/99
to
In article <7j0u0s$7o3$1...@nnrp1.deja.com>, <greg...@my-deja.com> wrote:
>I've got an image in postscript format that I need to print inverted
>(ie: white->black and black->white, not rotated or mirrored). GSview on
>the PC doesn't seem to have this ability. Is there a postscript command
>to cause a page to print in inverse?

Assuming a color space of DeviceGray (i.e. setgray is the only color
value setting command) you could try the following:
/MySetGray {setgray} bind def
/setgray {1 exch sub MySetGray} bind def
to "reverse" the behaviour of setgray.

To set the initial color to white do:
1 MySetGray

You probably need to paint the page with the inverse of the default
white paper, in otherwords, black:
gsave initclip clippath 0 MySetGray fill grestore

Note that the presence of initclip means you won't be able to imbed
the page into another page.

This is gonna use up a lot of toner, why do you need/want to do this?


--
-- Rod --
ro...@polylogics.com

peter...@my-deja.com

unread,
Jun 4, 1999, 3:00:00 AM6/4/99
to
In article <7j0u0s$7o3$1...@nnrp1.deja.com>,
greg...@my-deja.com wrote:
> I've got an image in postscript format that I need to print inverted
> (ie: white->black and black->white, not rotated or mirrored). GSview
on
> the PC doesn't seem to have this ability. Is there a postscript
command
> to cause a page to print in inverse?

The most reliable way to do this is by setting up transfer functions
outside the main PostScript code. Then, assuming the code you're
printing doesn't further muck with the transfer functions, you should
get the effect you want.

The simplest (Level 1) approach is something like

{1 exch sub} settransfer

To be polite, you should consider that fact that there may already be a
transfer function set, and concatenate it to yours:

[currenttransfer //exec {1 exch sub} //exec] cvx bind settransfer

I think that's right. I haven't actually tested this code. If you
want to deal with separate transfer functions for separate colors,
etc., it gets more complicated, but it's about the same idea. That's
left as an exercise for the reader.

-pd

0 new messages