Path: utzoo!mnetor!uunet!munnari!otc!metro!basser!natmlab!adrianb From: adrianb@natmlab.dms.oz (Adrian Baddeley) Newsgroups: comp.windows.news Subject: Scanned images in NeWS Message-ID: <2124@natmlab.dms.oz> Date: 11 Mar 88 08:19:46 GMT Organization: CSIRO Maths and Stats & Applied Physics, Sydney, Australia Lines: 47 Keywords: image, dithering, color maps Question: is there a 'clean' way to control the decisions made by the NeWS server in displaying scanned images ? We have several Sun-3's running NeWS 1.1 and we display images using the NeWS/PostScript operators "image", "buildimage" or "readcanvas". Two problems appear when you are doing this for image analysis research (rather than just to achieve nice graphics). - For small images (say less than 30 pixels across) the NeWS server's colour dithering actually smears whole pixels. What should be a 30x30 checkerboard looks like it has been in the rain. See code below for an example. - NeWS has decreed the contents of the screen's hardware colour lookup table, and these 256 colours may give a bad rendering of some images. There doesn't seem to be a NeWS facility for altering the colour table. We have resorted to tricking NeWS by altering the framebuffer colour map using pixrect calls (or writing directly to /dev/fb). Any better suggestions?? Example of dithering problem: the following asks for an n-by-n image of a single colour. It should appear as a solid block of colour. Instead, for small n you get a rather fetching watercolour effect. .......................................... 100 100 scale /str 3 string def /x 0 def /y 0 def /negy 0 def /makeimage { currentfile str readhexstring pop pop % read byte data /y exch store /x exch store % read width & height /negy y neg store x y 24 [x 0 0 negy 0 y] {str} buildimage imagecanvas % display } def 50 50 makeimage FF0000 % a 50x50 block of red: comes out OK 1 1 makeimage FF0000 % a 1x1 block of red: looks smeared 10 10 makeimage FF0000 % a 10x10 block of red: bottom line smeared ................................................................. "Dyslexia? What's lysdexia?" Adrian Baddeley, CSIRO Division of Mathematics & Statistics, Sydney. POST: CSIRO Div of Maths & Stats,Box 218, Lindfield NSW 2070, Australia. PHONE: +61 2 467 6062 (24 hrs) ACSNET: adrianb@natmlab.dms.oz.au{@munnari.oz}