Path: utzoo!attcan!uunet!clyde.concordia.ca!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!ames!sgi!paul@manray.sgi.com From: paul@manray.sgi.com (Paul Haeberli) Newsgroups: comp.sys.sgi Subject: Re: Trouble with Iris IMG library Summary: Here's some help . . . Message-ID: <54007@sgi.sgi.com> Date: 19 Mar 90 17:50:11 GMT Sender: paul@manray.sgi.com Distribution: na Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 73 The reason you had problems converting a file from Alias QuickPaint is that QuickPaint saves its images as colo(u)r index pixels. To use a QuickPaint image with the image processing tools or the image library it is best to convert it into an RGB image. The following script does just that by first saving the current colo(u)r-map, and then mapping the color indexed pixels into rgb space. The programs "savemap" and "mapimg" can be found in /usr/people/4Dgifts/iristools/imgtools if they aren't found in /usr/sbin. This is fromqp: #! /bin/sh if [ $# != 2 ] then echo "usage: fromqp in.qp out.rgb" exit 1 fi savemap /tmp/qp.map mapimg $1 $2 /tmp/qp.map rm /tmp/qp.map To write out an rgb IRIS image from a renderer use a sequence of image library calls like this: #include "gl/image.h" /* * writeiris - * This function takes three arrays of unsigned characters and * writes these as pixel data to an IRIS image file that can be ipasted * to the screen. * */ writeiris(rbuf,gbuf,bbuf,xsize,ysize) unsigned char *rbuf, *gbuf, *bbuf; int xsize, ysize; { IMAGE *oimage; unsigned short *rs, *gs, *bs; int x, y; rs = (unsigned short *)malloc(xsize*sizeof(unsigned short)); gs = (unsigned short *)malloc(xsize*sizeof(unsigned short)); bs = (unsigned short *)malloc(xsize*sizeof(unsigned short)); oimage = iopen("render.rgb","w",RLE(1),3,xsize,ysize,3); for(y=0; y