rgrodrig@pb2esac.UUCP (Robert Rodriguez) (09/13/90)
Hey guys! I've got a real dumb question to ask. The object: To convert an X11 bitmap image (solid black logo) into postscript, then use "setgray" (I think) to make the image lighter, and put some text over it. The method: I've used the PBMPLUS package to convert the bitmap into postscript without a problem. Then I thought I'd just add a ".5 setgray". The problem: No matter what I do, the image is always solid black. I am not a postscript programmer, but I need to get this done for a semi-important project. Thanks for any help, Robert (415) 545-8313
jwz@lucid.com (Jamie Zawinski) (09/14/90)
In article <265@pb2esac.UUCP> rgrodrig@pb2esac.UUCP (Robert Rodriguez) writes: > The object: > To convert an X11 bitmap image (solid black logo) into > postscript, then use "setgray" (I think) to make the image lighter, > and put some text over it. > The method: > I've used the PBMPLUS package to convert the bitmap > into postscript without a problem. Then I thought I'd just add > a ".5 setgray". setgray only affects what the "lineto", "fill" etc commands do. It doesn't affect bitmaps. Also, what you really want (I think) is to take a bit of PostScript code and make it (say) 50% lighter. If the code had setgray's in it, they would override the setgray you did. Try this: /fade-factor 0.25 def gsave { 1 exch sub fade-factor mul 1 exch sub } settransfer < put the code you want to lighten here > grestore This will make the image be 25% of full intensity. -- Jamie
flar@bendenweyr.Eng.Sun.COM (Jim Graham) (09/14/90)
In article <265@pb2esac.UUCP>, rgrodrig@pb2esac.UUCP (Robert Rodriguez) writes: |> The object: |> |> To convert an X11 bitmap image (solid black logo) into |> postscript, then use "setgray" (I think) to make the image lighter, |> and put some text over it. |> |> The method: |> |> I've used the PBMPLUS package to convert the bitmap |> into postscript without a problem. Then I thought I'd just add |> a ".5 setgray". It probably wrapped the image bits up and used the PostScript image operator. |> The problem: |> |> No matter what I do, the image is always solid black. The image operator considers that the image data is actually a grey level and since the color is already encoded into the image, the current color in the graphics state gets ignored. What you want to use is the imagemask operator which is similar to the image operator except that the image is assumed to be a 1 bit deep image which is used as a mask to specify where to apply the current color. The two forms are: width height bits/sample [PS matrix] {PS proc} _image_ and width height invertflag [PS matrix] {PS proc} _imagemask_ If the code generated by PBMPLUS used "1" for the bits/sample, then you only need to do the following to get your desired results: 1) Add a .5 setgray at the top of the file. 2) Change the "1" (bits/sample) to a "true" (invertflag) 3) change the "image" to an "imagemask". If it used a bits/sample of more than "1", then you need to change each sample in the image data to be halfway lighter. Exactly how to do that is too hard to explain without seeing the file (and there are probably easier ways to achieve the results you seek). ...jim
shiva@well.sf.ca.us (Kenneth Porter) (09/29/90)
To my knowledge, the image operator has its own idea of gray scale and ignores setgray values. If you just need 50% gray, add a second bitplane to the image and make the high-order bitplane all zeroes. You can synthesize this effect by creating an appropriate procedure that adds a zero after every bit, and pass this to image. The ability to pass a procedure to image to gather pixel values is quite powerful. You can get other grays by replacing each bit with an n-bit value representing a gray between 0 and 2^n-1. As Jamie Zawinski points out, settransfer can also be used, but you should modify his example to concatenate the new transfer proc with the result of currenttransfer, so that the result can be combined with previous transfer ops (the most important being any builtin engine compensation). Hope this helps. Ken (shiva@well.sf.ca.us)
ijohnson@gara.une.oz.au (Ian Johnson) (05/28/91)
I've written a screen dump routine (in Turbo Pascal), based on the screen dump approach described in the green postscript recipes (I don't have teh exact details of the book in front of me). It works fine, but if I have several screen dumps in one file they come out alternately OK and then white on black!! I don't really know anything about PostScript, but I gues I have got to put a specific command at the end of printing one screen to restore to black on white. The final commands, after the screen image, are grestore showpage I thought the grestore would fix it up, but obviously not. If anyone can follow these garbled instructions and can help me out, I'd be very grateful. Thanks, Ian Johnson email: ijohnson@gara.une.oz.au