From: story@sgi.com (David (Duis) Story)
Newsgroups: comp.sys.sgi
Subject: Re: SGI FILE FORMAT (please post)
Date: 26 Jan 93 19:29:26 GMT
Organization: Silicon Graphics, Inc.

In article <30741@castle.ed.ac.uk> eonu24@castle.ed.ac.uk (I Reid) writes:
>Malcolm Bersohn asked:
>  >    Does anyone know where I can find a detailed description of the
>  >file format of the SGI image files?

The image format is quite public, it just isn't well publiSHED.

Here is a postscript file describing the image file format and the
routines in libimage.a for accessing SGI Images.  See also 'man
istat'.

Cheers,

David Story                        	        Silicon Graphics, Inc.
story@bent.wpd.sgi.com				Mountain View, California

I've changed my name, so duis@sgi.com may bounce, please use story@sgi.com.

%!PS-Adobe-1.0
%%Creator: manray:paul (Paul Haeberli)
%%Title: stdin (ditroff)
%%CreationDate: Thu Oct 24 13:29:43 1991
%%EndComments
% Start of psdit.pro -- prolog for ditroff translator
% Copyright (c) 1985,1987 Adobe Systems Incorporated. All Rights Reserved. 
% GOVERNMENT END USERS: See Notice file in TranScript library directory
% -- probably /usr/lib/ps/Notice
% RCS: $Header: /cypress/att/usr/src/apps/trscript/lib/RCS/psdit.pro,v 1.3 89/04/26 19:34:25 wiltse Exp $
/$DITroff 140 dict def $DITroff begin
/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def
/xi {0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto
  /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F
  /pagesave save def}def
/PB{save /psv exch def currentpoint translate
  resolution 72 div dup neg scale 0 0 moveto}def
/PE{psv restore}def
/m1 matrix def /m2 matrix def /m3 matrix def /oldmat matrix def
/tan{dup sin exch cos div}bind def
/point{resolution 72 div mul}bind def
/dround	{transform round exch round exch itransform}bind def
/xT{/devname exch def}def
/xr{/mh exch def /my exch def /resolution exch def}def
/xp{}def
/xs{docsave restore end}def
/xt{}def
/xf{/fontname exch def /slotno exch def fontnames slotno get fontname eq not
 {fonts slotno fontname findfont put fontnames slotno fontname put}if}def
/xH{/fontheight exch def F}bind def
/xS{/fontslant exch def F}bind def
/s{/fontsize exch def /fontheight fontsize def F}bind def
/f{/fontnum exch def F}bind def
/F{fontheight 0 le {/fontheight fontsize def}if
   fonts fontnum get fontsize point 0 0 fontheight point neg 0 0 m1 astore
   fontslant 0 ne{1 0 fontslant tan 1 0 0 m2 astore m3 concatmatrix}if
   makefont setfont .04 fontsize point mul 0 dround pop setlinewidth}bind def
/X{exch currentpoint exch pop moveto show}bind def
/N{3 1 roll moveto show}bind def
/Y{exch currentpoint pop exch moveto show}bind def
/S /show load def
/ditpush{}def/ditpop{}def
/AX{3 -1 roll currentpoint exch pop moveto 0 exch ashow}bind def
/AN{4 2 roll moveto 0 exch ashow}bind def
/AY{3 -1 roll currentpoint pop exch moveto 0 exch ashow}bind def
/AS{0 exch ashow}bind def
/MX{currentpoint exch pop moveto}bind def
/MY{currentpoint pop exch moveto}bind def
/MXY /moveto load def
/cb{pop}def	% action on unknown char -- nothing for now
/n{}def/w{}def
/p{pop showpage pagesave restore /pagesave save def}def
/abspoint{currentpoint exch pop add exch currentpoint pop add exch}def
/dstroke{currentpoint stroke moveto}bind def
/Dl{2 copy gsave rlineto stroke grestore rmoveto}bind def
/arcellipse{oldmat currentmatrix pop
 currentpoint translate 1 diamv diamh div scale /rad diamh 2 div def
 rad 0 rad -180 180 arc oldmat setmatrix}def
/Dc{gsave dup /diamv exch def /diamh exch def arcellipse dstroke 
    grestore diamh 0 rmoveto}def
/De{gsave /diamv exch def /diamh exch def arcellipse dstroke
    grestore diamh 0 rmoveto}def
/Da{currentpoint /by exch def /bx exch def /fy exch def /fx exch def
   /cy exch def /cx exch def /rad cx cx mul cy cy mul add sqrt def
   /ang1 cy neg cx neg atan def /ang2 fy fx atan def cx bx add cy by add
   2 copy rad ang1 ang2 arcn stroke exch fx add exch fy add moveto}def
/Barray 200 array def % 200 values in a wiggle
/D~{mark}def
/D~~{counttomark Barray exch 0 exch getinterval astore /Bcontrol exch def pop
 /Blen Bcontrol length def Blen 4 ge Blen 2 mod 0 eq and
 {Bcontrol 0 get Bcontrol 1 get abspoint /Ycont exch def /Xcont exch def
  Bcontrol 0 2 copy get 2 mul put Bcontrol 1 2 copy get 2 mul put
  Bcontrol Blen 2 sub 2 copy get 2 mul put
  Bcontrol Blen 1 sub 2 copy get 2 mul put
  /Ybi /Xbi currentpoint 3 1 roll def def 0 2 Blen 4 sub
  {/i exch def
   Bcontrol i get 3 div Bcontrol i 1 add get 3 div
   Bcontrol i get 3 mul Bcontrol i 2 add get add 6 div
   Bcontrol i 1 add get 3 mul Bcontrol i 3 add get add 6 div
   /Xbi Xcont Bcontrol i 2 add get 2 div add def
   /Ybi Ycont Bcontrol i 3 add get 2 div add def
   /Xcont Xcont Bcontrol i 2 add get add def
   /Ycont Ycont Bcontrol i 3 add get add def
   Xbi currentpoint pop sub Ybi currentpoint exch pop sub rcurveto
  }for dstroke}if}def
end
/ditstart{$DITroff begin
 /nfonts 60 def			% NFONTS makedev/ditroff dependent!
 /fonts[nfonts{0}repeat]def
 /fontnames[nfonts{()}repeat]def
/docsave save def
}def

% character outcalls
/oc {/pswid exch def /cc exch def /name exch def
   /ditwid pswid fontsize mul resolution mul 72000 div def
   /ditsiz fontsize resolution mul 72 div def
   ocprocs name known{ocprocs name get exec}{name cb}
   ifelse}def
/fractm [.65 0 0 .6 0 0] def
/fraction
 {/fden exch def /fnum exch def gsave /cf currentfont def
  cf fractm makefont setfont 0 .3 dm 2 copy neg rmoveto
  fnum show rmoveto currentfont cf setfont(\244)show setfont fden show 
  grestore ditwid 0 rmoveto} def
/oce {grestore ditwid 0 rmoveto}def
/dm {ditsiz mul}def
/ocprocs 50 dict def ocprocs begin
(14){(1)(4)fraction}def
(12){(1)(2)fraction}def
(34){(3)(4)fraction}def
(13){(1)(3)fraction}def
(23){(2)(3)fraction}def
(18){(1)(8)fraction}def
(38){(3)(8)fraction}def
(58){(5)(8)fraction}def
(78){(7)(8)fraction}def
(sr){gsave .05 dm .16 dm rmoveto(\326)show oce}def
(is){gsave 0 .15 dm rmoveto(\362)show oce}def
(->){gsave 0 .02 dm rmoveto(\256)show oce}def
(<-){gsave 0 .02 dm rmoveto(\254)show oce}def
(==){gsave 0 .05 dm rmoveto(\272)show oce}def
end
% DIThacks fonts for some special chars
50 dict dup begin
/FontType 3 def
/FontName /DIThacks def
/FontMatrix [.001 0.0 0.0 .001 0.0 0.0] def
/FontBBox [-220 -280 900 900] def% a lie but ...
/Encoding 256 array def
0 1 255{Encoding exch /.notdef put}for
Encoding
 dup 8#040/space put %space
 dup 8#110/rc put %right ceil
 dup 8#111/lt put %left  top curl
 dup 8#112/bv put %bold vert
 dup 8#113/lk put %left  mid curl
 dup 8#114/lb put %left  bot curl
 dup 8#115/rt put %right top curl
 dup 8#116/rk put %right mid curl
 dup 8#117/rb put %right bot curl
 dup 8#120/rf put %right floor
 dup 8#121/lf put %left  floor
 dup 8#122/lc put %left  ceil
 dup 8#140/sq put %square
 dup 8#141/bx put %box
 dup 8#142/ci put %circle
 dup 8#143/br put %box rule
 dup 8#144/rn put %root extender
 dup 8#145/vr put %vertical rule
 dup 8#146/ob put %outline bullet
 dup 8#147/bu put %bullet
 dup 8#150/ru put %rule
 dup 8#151/ul put %underline
 pop
/DITfd 100 dict def
/BuildChar{0 begin
 /cc exch def /fd exch def
 /charname fd /Encoding get cc get def
 /charwid fd /Metrics get charname get def
 /charproc fd /CharProcs get charname get def
 charwid 0 fd /FontBBox get aload pop setcachedevice
 40 setlinewidth
 newpath 0 0 moveto gsave charproc grestore
 end}def
/BuildChar load 0 DITfd put
%/UniqueID 5 def
/CharProcs 50 dict def
CharProcs begin
/space{}def
/.notdef{}def
/ru{500 0 rls}def
/rn{0 750 moveto 500 0 rls}def
/vr{20 800 moveto 0 -770 rls}def
/bv{20 800 moveto 0 -1000 rls}def
/br{20 770 moveto 0 -1040 rls}def
/ul{0 -250 moveto 500 0 rls}def
/ob{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath stroke}def
/bu{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath fill}def
/sq{80 0 rmoveto currentpoint dround newpath moveto
    640 0 rlineto 0 640 rlineto -640 0 rlineto closepath stroke}def
/bx{80 0 rmoveto currentpoint dround newpath moveto
    640 0 rlineto 0 640 rlineto -640 0 rlineto closepath fill}def
/ci{355 333 rmoveto currentpoint newpath 333 0 360 arc
    50 setlinewidth stroke}def

/lt{20 -200 moveto 0 550 rlineto currx 800 2cx s4 add exch s4 a4p stroke}def
/lb{20 800 moveto 0 -550 rlineto currx -200 2cx s4 add exch s4 a4p stroke}def
/rt{20 -200 moveto 0 550 rlineto currx 800 2cx s4 sub exch s4 a4p stroke}def
/rb{20 800 moveto 0 -500 rlineto currx -200 2cx s4 sub exch s4 a4p stroke}def
/lk{20 800 moveto 20 300 -280 300 s4 arcto pop pop 1000 sub
    currentpoint stroke moveto
    20 300 4 2 roll s4 a4p 20 -200 lineto stroke}def
/rk{20 800 moveto 20 300 320 300 s4 arcto pop pop 1000 sub
    currentpoint stroke moveto
    20 300 4 2 roll s4 a4p 20 -200 lineto stroke}def
/lf{20 800 moveto 0 -1000 rlineto s4 0 rls}def
/rf{20 800 moveto 0 -1000 rlineto s4 neg 0 rls}def
/lc{20 -200 moveto 0 1000 rlineto s4 0 rls}def
/rc{20 -200 moveto 0 1000 rlineto s4 neg 0 rls}def
end

/Metrics 50 dict def Metrics begin
/.notdef 0 def
/space 500 def
/ru 500 def
/br 0 def
/lt 250 def
/lb 250 def
/rt 250 def
/rb 250 def
/lk 250 def
/rk 250 def
/rc 250 def
/lc 250 def
/rf 250 def
/lf 250 def
/bv 250 def
/ob 350 def
/bu 350 def
/ci 750 def
/bx 750 def
/sq 750 def
/rn 500 def
/ul 500 def
/vr 0 def
end

DITfd begin
/s2 500 def /s4 250 def /s3 333 def
/a4p{arcto pop pop pop pop}def
/2cx{2 copy exch}def
/rls{rlineto stroke}def
/currx{currentpoint pop}def
/dround{transform round exch round exch itransform} def
end
end
/DIThacks exch definefont pop

ditstart
(psc)xT
576 1 1 xr
1(Times-Roman)xf 1 f
2(Times-Italic)xf 2 f
3(Times-Bold)xf 3 f
4(Times-BoldItalic)xf 4 f
5(Helvetica)xf 5 f
6(Helvetica-Bold)xf 6 f
7(Courier)xf 7 f
8(Courier-Bold)xf 8 f
9(Symbol)xf 9 f
10(DIThacks)xf 10 f
10 s
1 f
xi
%%EndProlog

%%Page: 1 1
10 s 0 xH 0 xS 1 f
12 s
3 f
1429 688(libimage.a:)N
1910(Using)X
2168(The)X
2352(IRIS)X
2572(Image)X
2852(Library)X
1 f
10 s
776 908(IRIS)N
947(image)X
1163(\256les)X
1316(are)X
1435(used)X
1602(to)X
1684(store)X
1860(1)X
1920(2)X
1980(and)X
2116(3)X
2177(dimensional)X
2589(arrays)X
2807(of)X
2895(pixel)X
3076(values)X
3302(that)X
3443(contain)X
3700(either)X
3904(1)X
3965(or)X
576 1004(2)N
639(bytes)X
831(per)X
957(pixel.)X
1180(Pixel)X
1367(values)X
1595(are)X
1717(signed)X
1949(integers)X
2226(that)X
2369(cover)X
2571(the)X
2692(range)X
2894(0..255)X
3116(or)X
3205(-32768..32767)X
3694(\(i.e.)X
3841(1)X
3903(or)X
3992(2)X
576 1100(bytes\).)N
845(Image)X
1079(\256les)X
1245(are)X
1377(currently)X
1700(used)X
1880(to)X
1975(store)X
2164(rgb)X
2304(screen)X
2543(dumps,)X
2809(black)X
3016(and)X
3165(white)X
3376(images,)X
3656(color)X
3854(index)X
576 1196(images,)N
846(as)X
935(well)X
1095(as)X
1184(colormaps.)X
1580(To)X
1691(use)X
1820(the)X
1940(image)X
2158(library,)X
2414(put)X
2538(the)X
2658(token)X
2858(-limage)X
3125(on)X
3227(the)X
3347(compile)X
3627(line)X
3769(for)X
3885(your)X
576 1292(program.)N
913(Also,)X
1109(be)X
1210(sure)X
1369(to)X
1456(include)X
1717(image.h)X
1998(from)X
2179(/usr/include/gl)X
2666(in)X
2753(any)X
2894(source)X
3129(\256les)X
3287(that)X
3432(use)X
3564(these)X
3754(routines.)X
576 1388(The)N
721(following)X
1052(routines)X
1330(provide)X
1595(a)X
1651(procedural)X
2015(interface)X
2317(to)X
2399(image)X
2615(\256les:)X
3 f
576 1676(Opening)N
888(and)X
1036(Closing)X
1313(an)X
1417(Image)X
1651(File)X
8 f
864 1820(IMAGE)N
1152(*iopen\(file,)X
1776(mode)X
2016([,)X
2160(type,)X
2448(dim,)X
2688(xsize,)X
3024(ysize,)X
3360(zsize]\))X
864 1916(char)N
1104(*file;)X
864 2012(register)N
1296(char)X
1536(*mode;)X
864 2108(unsigned)N
1296(int)X
1488(type,)X
1776(dim,)X
2016(xsize,)X
2352(ysize,)X
2688(zsize;)X
1 f
776 2280(Opens)N
1006(an)X
1107(image)X
1328(\256le)X
1455(for)X
1574(reading)X
1840(or)X
1932(writing)X
2188(and)X
2329(returns)X
2577(a)X
2638(pointer)X
2890(to)X
2977(IMAGE)X
3265(in)X
3352(the)X
3475(same)X
3665(style)X
3841(as)X
3934(the)X
576 2376(UNIX)N
801(standard)X
1097(i/o)X
1205(library.)X
1483(A)X
1565(return)X
1781(value)X
1979(of)X
2070(0)X
2134(means)X
2363(the)X
2485(function)X
2776(failed)X
2983(to)X
3069(successfully)X
3485(open)X
3665(the)X
3787(\256le)X
3912(that)X
576 2472(was)N
721(named.)X
776 2596(To)N
890(open)X
1071(an)X
1172(image)X
1393(\256le)X
1520(for)X
1639(reading,)X
1925(iopen)X
2128(should)X
2366(be)X
2467(called)X
2684(with)X
2851(2)X
2916(arguments,)X
3295(the)X
3419(name)X
3619(of)X
3712(the)X
3836(image)X
576 2692(\256le)N
707(to)X
798(open)X
983(and)X
1128(a)X
1193(mode)X
1400(of)X
1496("r".)X
1657(The)X
1810(dimensions)X
2202(of)X
2297(the)X
2423(image)X
2647(may)X
2813(be)X
2917(determined)X
3306(by)X
3414(referencing)X
3809(image-)X
576 2788(>xsize,)N
831(image->ysize,)X
1309(and)X
1450(image->zsize,)X
1924(where)X
2146(image)X
2367(is)X
2445(the)X
2568(value)X
2767(returned)X
3060(by)X
3165(iopen.)X
3409(xsize)X
3600(and)X
3742(ysize)X
3933(are)X
576 2884(de\256ned)N
833(in)X
916(terms)X
1115(of)X
1202(pixels)X
1413(while)X
1611(zsize)X
1792(describes)X
2111(the)X
2229(number)X
2494(of)X
2581(channels)X
2882(\(i.e.)X
3027(layers\))X
3266(the)X
3384(image)X
3600(contains.)X
3907(The)X
576 2980(value)N
776(of)X
869(image->dim)X
1287(indicates)X
1598(whether)X
1883(the)X
2007(image)X
2229(is)X
2308(just)X
2449(a)X
2511(single)X
2728(row)X
2880(\(one)X
3050(dimensional\))X
3495(or)X
3589(is)X
3669(an)X
3772(array)X
3965(of)X
576 3076(rows)N
752(\(two)X
919(dimensional\))X
1357(or)X
1444(is)X
1517(an)X
1613(array)X
1799(of)X
1886(2)X
1946(dimensional)X
2357(images)X
2604(\(three)X
2812(dimensional\).)X
776 3200(An)N
894(rgb)X
1021(image)X
1238(can)X
1371(be)X
1468(thought)X
1733(of)X
1821(as)X
1909(a)X
1966(set)X
2076(of)X
2164(three)X
2346(2)X
2407(dimensional)X
2819(images.)X
3107(Sometimes)X
3483(this)X
3619(is)X
3693(referred)X
3970(to)X
576 3296(as)N
668(a)X
729(3)X
794(channel)X
1069(image.)X
1330(An)X
1453(rgb)X
1585(color)X
1775(image)X
1996(consists)X
2273(of)X
2364(3)X
2428(channels)X
2733(\(one)X
2900(channel)X
3174(each)X
3346(for)X
3464(the)X
3586(red)X
3713(green)X
3916(and)X
576 3392(blue)N
736(components)X
1145(of)X
1234(the)X
1354(image\))X
1599(and)X
1737(is)X
1812(represented)X
2205(as)X
2295(a)X
2354(three)X
2538(dimensional)X
2952(image)X
3171(that)X
3314(is)X
3390(xsize)X
3578(by)X
3681(ysize)X
3869(by)X
3972(3.)X
576 3488(A)N
660(black)X
860(and)X
1002(white)X
1206(image)X
1428(has)X
1561(one)X
1703(channel)X
1979(and)X
2121(is)X
2200(represented)X
2597(as)X
2690(a)X
2752(two)X
2898(dimensional)X
3315(image)X
3537(that)X
3683(is)X
3762(xsize)X
3952(by)X
576 3584(ysize.)N
776 3708(Other)N
988(information)X
1395(may)X
1563(be)X
1669(found)X
1886(in)X
1978(image->name)X
2450(\(holds)X
2680(the)X
2808(string)X
3020(that)X
3170(is)X
3253(usually)X
3514(the)X
3642(same)X
3837(as)X
3934(the)X
576 3804(actual)N
801(image)X
1030(\256lename\),)X
1386(image->colormap)X
1990(\(de\256nes)X
2277(whether)X
2569(the)X
2700(image)X
2929(is)X
3015(a)X
3084(series)X
3300(of)X
3400(intensity)X
3708(values,)X
3965(or)X
576 3900(color)N
776(lookup)X
1033(table)X
1224(indices,)X
1506(or)X
1608(an)X
1719(actual)X
1946(colormap\),)X
2331(image->max)X
2772(\(the)X
2933(maximum)X
3293(intensity)X
3604(stored)X
3836(in)X
3934(the)X
576 3996(image\),)N
839(and)X
975(image->min)X
1387(\(the)X
1532(minimum)X
1862(intensity)X
2157(stored)X
2373(in)X
2455(the)X
2573(image\).)X
776 4120(To)N
890(open)X
1071(an)X
1172(image)X
1393(\256le)X
1521(for)X
1641(writing,)X
1918(iopen)X
2122(should)X
2361(be)X
2463(called)X
2681(with)X
2849(7)X
2915(arguments,)X
3295(the)X
3419(name)X
3619(of)X
3712(the)X
3836(image)X
576 4216(\256le)N
703(to)X
790(open,)X
991(and)X
1132(a)X
1193(mode)X
1396(of)X
1488("w",)X
1657(followed)X
1967(by)X
2072(the)X
2195(type,)X
2378(the)X
2501(number)X
2771(of)X
2863(dimensions)X
3252(and)X
3393(the)X
3516(xsize,)X
3726(ysize)X
3916(and)X
576 4312(zsize)N
761(of)X
852(the)X
974(image.)X
1234(The)X
1383(type)X
1545(indicates)X
1854(how)X
2016(many)X
2218(bytes)X
2411(are)X
2535(stored)X
2756(per)X
2884(pixel)X
3069(value,)X
3288(and)X
3429(whether)X
3713(the)X
3836(image)X
576 4408(\256le)N
705(should)X
945(be)X
1048(run-length)X
1409(encoded.)X
1744(Type)X
1936(may)X
2101(be)X
2204(given)X
2408(as)X
2501(RLE\(1\),)X
2792(RLE\(2\),)X
3083(VERBATIM\(1\),)X
3641(or)X
3734(VERBA-)X
576 4504(TIM\(2\).)N
885(Run-length)X
1273(encoded)X
1569(\(RLE\))X
1802(image)X
2026(\256les)X
2187(are)X
2314(more)X
2507(ef\256ciently)X
2860(stored)X
3084(than)X
3250(verbatim)X
3564(\256les)X
3726(where)X
3952(no)X
576 4600(compression)N
1006(algorithm)X
1342(is)X
1420(used.)X
1632(1)X
1697(or)X
1789(2)X
1854(in)X
1941(the)X
2064(above)X
2281(speci\256es)X
2582(how)X
2745(many)X
2948(bytes)X
3142(are)X
3265(used)X
3436(for)X
3554(each)X
3726(pixel)X
3910(in)X
3996(a)X
576 4696(colormap)N
907(image,)X
1151(or)X
1246(for)X
1369(each)X
1546(channel)X
1825(in)X
1916(an)X
2021(rgb)X
2157(image.)X
2422(RLE\(2\))X
2696(or)X
2792(VERBATIM\(2\))X
3333(is)X
3415(used)X
3591(to)X
3682(store)X
3867(color)X
576 4792(index)N
785(images)X
1043(that)X
1194(contain)X
1461(12)X
1572(bits)X
1718(per)X
1851(pixel.)X
2081(RLE\(1\))X
2356(is)X
2439(the)X
2567(recommended)X
3052(default)X
3305(for)X
3429(rgb)X
3566(and)X
3712(black)X
3916(and)X
576 4888(white)N
774(images.)X
8 f
864 5224(iclose\(image\))N
864 5320(register)N
1296(IMAGE)X
1664(*image;)X
1 f
776 5492(Closes)N
1010(an)X
1107(image)X
1324(\256le)X
1447(that)X
1588(was)X
1734(open)X
1911(for)X
2026(reading)X
2288(or)X
2376(writing.)X
2668(All)X
2791(output)X
3016(is)X
3090(\257ushed)X
3342(to)X
3426(the)X
3546(output)X
3772(\256le,)X
3916(and)X
576 5588(the)N
694(output)X
918(\256le)X
1040(is)X
1113(closed.)X

2 p
%%Page: 2 2
10 s 0 xH 0 xS 1 f
2237 384(-)N
2284(2)X
2344(-)X
3 f
576 960(Reading)N
880(and)X
1028(Writing)X
1319(an)X
1423(Image)X
1657(File)X
1 f
776 1084(The)N
929(following)X
1268(functions)X
1594(allow)X
1800(pixels)X
2019(to)X
2109(be)X
2213(transferred)X
2591(to)X
2682(and)X
2827(from)X
3012(an)X
3117(image)X
3342(\256le.)X
3513(These)X
3734(functions)X
576 1180(provide)N
844(an)X
943(interface)X
1248(to)X
1333(an)X
1431(image)X
1649(\256le)X
1773(that)X
1915(is)X
1990(independent)X
2404(of)X
2493(whether)X
2774(the)X
2894(image)X
3112(\256le)X
3236(happens)X
3521(to)X
3605(be)X
3703(run)X
3832(length)X
576 1276(encoded,)N
884(and)X
1020(independent)X
1432(of)X
1519(whether)X
1798(it)X
1862(maintains)X
2193(1)X
2253(or)X
2340(2)X
2400(bytes)X
2589(per)X
2712(pixel.)X
8 f
864 1420(putrow\(image,buffer,y,z\))N
864 1516(register)N
1296(IMAGE)X
1664(*image;)X
864 1612(unsigned)N
1296(short)X
1664(*buffer;)X
864 1708(unsigned)N
1464(y,)X
1608(z;)X
1 f
776 1880(Writes)N
1010(a)X
1066(row)X
1211(of)X
1298(pixels)X
1509(to)X
1591(the)X
1710(speci\256ed)X
2016(image)X
2233(\256le.)X
2376(The)X
2522(buffer)X
2740(should)X
2974(be)X
3071(an)X
3168(array)X
3355(of)X
3443(shorts)X
3655(that)X
3796(contain)X
576 1976(the)N
697(pixel)X
880(values)X
1108(of)X
1198(a)X
1257(colormap)X
1583(image)X
1802(or)X
1892(one)X
2031(of)X
2121(the)X
2242(3)X
2305(channels)X
2609(of)X
2698(an)X
2796(rgb)X
2925(image.)X
3183(If)X
3259(the)X
3379(image)X
3597(\256le)X
3721(maintains)X
576 2072(only)N
740(one)X
879(byte)X
1040(per)X
1166(pixel,)X
1369(then)X
1530(the)X
1651(values)X
1879(passed)X
2116(in)X
2201(the)X
2322(buffer)X
2542(should)X
2778(be)X
2877(in)X
2962(the)X
3083(range)X
3285(0..255.)X
3548(The)X
3696(row)X
3844(of)X
3934(the)X
576 2168(image)N
794(to)X
878(be)X
976(written)X
1225(is)X
1300(given)X
1500(by)X
1602(y,)X
1684(while)X
1884(z)X
1942(selects)X
2178(which)X
2396(channel)X
2668(of)X
2757(the)X
2877(image)X
3095(to)X
3179(write)X
3366(to.)X
3490(The)X
3637(\256rst)X
3782(channel)X
576 2264(of)N
671(the)X
797(image)X
1022(is)X
1104(channel)X
1383(0.)X
1492(A)X
1579(black)X
1782(and)X
1927(white)X
2134(image)X
2359(will)X
2512(have)X
2693(only)X
2864(1)X
2933(channel)X
3212(while)X
3419(rgb)X
3555(images)X
3811(have)X
3992(3)X
576 2360(channels.)N
918(In)X
1006(an)X
1103(rgb)X
1231(image,)X
1468(channel)X
1739(0)X
1800(is)X
1874(used)X
2042(to)X
2125(store)X
2302(red)X
2425(while)X
2623(channel)X
2893(1)X
2953(stores)X
3160(green,)X
3379(and)X
3515(channel)X
3785(2)X
3845(stores)X
576 2456(blue)N
745(pixel)X
936(data.)X
1141(The)X
1297(y)X
1368(argument)X
1702(should)X
1946(be)X
2053(greater)X
2308(than)X
2477(or)X
2575(equal)X
2780(to)X
2873(zero)X
3043(and)X
3190(less)X
3341(than)X
3510(the)X
3639(ysize)X
3835(of)X
3934(the)X
576 2552(image.)N
832(The)X
977(rows)X
1153(of)X
1240(the)X
1358(image)X
1574(\256le)X
1696(may)X
1854(be)X
1950(written)X
2197(in)X
2279(any)X
2415(order.)X
8 f
864 2696(getrow\(image,buffer,y,z\))N
864 2792(register)N
1296(IMAGE)X
1584(*image;)X
864 2888(unsigned)N
1296(short)X
1584(*buffer;)X
864 2984(register)N
1296(unsigned)X
1728(int)X
1920(y,)X
2064(z;)X
1 f
776 3156(Reads)N
1004(a)X
1072(row)X
1229(of)X
1329(pixels)X
1553(from)X
1742(the)X
1873(speci\256ed)X
2191(image)X
2420(\256le.)X
2595(The)X
2753(buffer)X
2983(should)X
3229(be)X
3338(an)X
3447(array)X
3646(of)X
3746(shorts)X
3970(to)X
576 3252(receive)N
833(pixel)X
1017(values)X
1246(of)X
1337(a)X
1397(colormap)X
1724(image)X
1944(or)X
2034(one)X
2173(of)X
2263(the)X
2384(3)X
2447(channels)X
2751(of)X
2841(an)X
2940(rgb)X
3070(image.)X
3329(The)X
3477(row)X
3625(of)X
3715(the)X
3836(image)X
576 3348(to)N
664(be)X
766(read)X
931(is)X
1010(given)X
1214(by)X
1320(y,)X
1406(while)X
1610(z)X
1672(selects)X
1912(which)X
2134(channel)X
2410(of)X
2503(the)X
2627(image)X
2849(to)X
2937(read)X
3102(from.)X
3324(The)X
3475(\256rst)X
3625(channel)X
3902(of)X
3996(a)X
576 3444(image)N
799(is)X
879(channel)X
1156(0.)X
1263(A)X
1348(black)X
1549(and)X
1692(white)X
1897(image)X
2120(will)X
2271(have)X
2450(only)X
2619(1)X
2686(channel,)X
2983(while)X
3187(an)X
3289(rgb)X
3422(image)X
3644(will)X
3794(have)X
3972(3.)X
576 3540(The)N
725(y)X
789(argument)X
1116(should)X
1353(be)X
1453(greater)X
1701(than)X
1863(or)X
1954(equal)X
2152(to)X
2238(zero)X
2401(and)X
2541(less)X
2685(than)X
2847(the)X
2969(ysize)X
3158(of)X
3250(the)X
3373(image.)X
3634(The)X
3784(rows)X
3965(of)X
576 3636(the)N
694(image)X
910(\256le)X
1032(may)X
1190(be)X
1286(read)X
1445(in)X
1527(any)X
1663(order.)X
3 f
576 3828(Miscellaneous)N
1076(Functions)X
8 f
864 3972(isetname\(image,name\))N
864 4068(IMAGE)N
1152(*image;)X
864 4164(char)N
1104(*name;)X
1 f
776 4336(Copies)N
1019(the)X
1138(character)X
1455(string)X
1658(name)X
1854(into)X
2000(the)X
2120(name)X
2316(\256eld)X
2480(of)X
2569(the)X
2689(image)X
2907(\256le.)X
3051(NOTE:)X
3329(handling)X
3631(names)X
3858(when)X
576 4432(processing)N
939(two)X
1079(\256les)X
1232(together)X
1515(is)X
1588(not)X
1710(well)X
1868(supported)X
2204(and)X
2340(is)X
2413(not)X
2535(encouraged.)X
8 f
864 4576(isetcolormap\(image,colormap\))N
864 4672(IMAGE)N
1152(*image;)X
864 4768(int)N
1056(colormap;)X
1 f
776 4940(Tells)N
960(ipaste)X
1171(and)X
1311(some)X
1504(printing)X
1781(utilities)X
2044(whether)X
2327(the)X
2449(pixel)X
2633(values)X
2862(should)X
3099(be)X
3199(interpreted)X
3571(as)X
3662(color-index)X
576 5036(pixels)N
788(or)X
876(intensities.)X
1241(A)X
1320(gray)X
1484(scale)X
1666(image)X
1883(consists)X
2157(of)X
2245(one)X
2382(channel)X
2653(of)X
2741(intensities,)X
3106(while)X
3305(an)X
3401(rgb)X
3528(image)X
3744(has)X
3871(three)X
576 5132(independent)N
993(channels)X
1300(of)X
1393(pixel)X
1579(intensities,)X
1949(one)X
2091(channel)X
2367(for)X
2487(each)X
2661(red,)X
2810(green)X
3015(and)X
3157(blue)X
3321(intensities.)X
3711(The)X
3862(argu-)X
576 5228(ment)N
757(colormap)X
1081(may)X
1240(be)X
1337(one)X
1474(of)X
1561(following)X
1892(three)X
2073(values:)X
2340(CM_NORMAL)X
2871(is)X
2944(the)X
3062(default)X
3305(indicating)X
3645(that)X
3785(the)X
3903(pix-)X
576 5324(els)N
690(are)X
814(intensity)X
1114(values.)X
1384(0)X
1449(is)X
1527(black)X
1726(and)X
1867(a)X
1928(value)X
2128(of)X
2221(255)X
2367(in)X
2455(the)X
2579(image)X
2801(is)X
2880(white.)X
3104(Black)X
3317(and)X
3459(white)X
3663(images)X
3916(and)X
576 5420(rgb)N
708(images)X
960(are)X
1084(stored)X
1305(with)X
1472(CM_NORMAL.)X
2048(CM_SCREEN)X
2543(indicates)X
2853(that)X
2998(the)X
3120(pixels)X
3335(were)X
3516(copied)X
3754(from)X
3934(the)X
576 5516(screen)N
807(and)X
948(must)X
1128(be)X
1229(transformed)X
1642(by)X
1747(a)X
1808(color)X
1998(map)X
2161(to)X
2248(be)X
2349(meaningful.)X
2759(Colormaps)X
3135(can)X
3272(also)X
3426(be)X
3527(stored)X
3748(in)X
3836(image)X
576 5612(\256les.)N
769(CM_COLORMAP)X
1397(means)X
1622(that)X
1762(the)X
1880(pixels)X
2091(in)X
2173(the)X
2291(image)X
2507(\256le)X
2629(represent)X
2944(a)X
3000(color)X
3185(map)X

3 p
%%Page: 3 3
10 s 0 xH 0 xS 1 f
2237 384(-)N
2284(3)X
2344(-)X
3 f
576 672(An)N
698(Example)X
1 f
776 796(The)N
923(following)X
1256(example)X
1551(shows)X
1774(how)X
1935(to)X
2020(open)X
2199(an)X
2298(image)X
2517(\256le)X
2642(and)X
2781(read)X
2943(its)X
3041(contents.)X
3371(More)X
3568(examples)X
3894(may)X
576 892(be)N
672(found)X
879(in)X
961(/usr/people/4Dgifts/iristools/imgtools.)X
8 f
8 s
576 1164(/*)N
614 1244(*)N
776 -0.4219(readimage)AX
1156(-)X
1232(Read)X
1422(an)X
1536(image)X
1764(file)X
1954(and)X
2106(print)X
2334(its)X
2486(pixel)X
2714(values.)X
614 1324(*)N
614 1404(*)N
776(To)X
890(compile:)X
1232(cc)X
1346 -0.4125(readimage.c)AX
1802(-o)X
1916 -0.4219(readimage)AX
2296(-limage)X
614 1484(*)N
614 1564(*)N
1376(Paul)X
1566(Haeberli)X
1908(-)X
1984(1991)X
614 1644(*/)N
728(#include)X
1070 -0.4091("gl/image.h")AX
576 1804 -0.4018(main\(argc,argv\))AN
1184(int)X
1336(argc;)X
1564(char)X
1754(**argv;)X
2058({)X
728 1884(IMAGE)N
956(*image;)X
728 1964(int)N
880(x,)X
994(y,)X
1108(z;)X
728 2044(short)N
956(*rbuf,)X
1222(*gbuf,)X
1488(*bbuf;)X
576 2204(/*)N
690(print)X
918(usage)X
1146(message)X
1450(*/)X
728 2284(if\()N
880(argc<2)X
1146(\))X
1222({)X
880 2364 -0.3929(fprintf\(stderr,"usage:)AN
1754 -0.4219(readimage)AX
2134 -0.4219(infile0\);)AX
880 2444(exit\(1\);)N
728 2524(})N
576 2684(/*)N
690(open)X
880(the)X
1032(image)X
1260(file)X
1450(*/)X
728 2764(if\()N
880 -0.3900(\(image=iopen\(argv[1],"r"\)\))AX
1906(==)X
2020(NULL)X
2210(\))X
2286({)X
880 2844 -0.3900(fprintf\(stderr,"readimage:)AN
1906(can't)X
2134(open)X
2324(input)X
2552(file)X
2742 -0.4062(%s0,argv[1]\);)AX
880 2924(exit\(1\);)N
728 3004(})N
576 3164(/*)N
690(print)X
918(a)X
994(little)X
1260(info)X
1450(about)X
1678(the)X
1830(image)X
2058(*/)X
728 3244 -0.4062(printf\("Image)AN
1260(x)X
1336(and)X
1488(y)X
1564(size)X
1754(in)X
1868(pixels:)X
2172(%d)X
2286 -0.3875(%d0,image->xsize,image->ysize\);)AX
728 3324 -0.4062(printf\("Image)AN
1260(zsize)X
1488(in)X
1602 -0.4219(channels:)AX
1982 -0.3971(%d0,image->zsize\);)AX
728 3404 -0.4062(printf\("Image)AN
1260(pixel)X
1488(min)X
1640(and)X
1792(max:)X
1982(%d)X
2096 -0.3900(%d0,image->min,image-max\);)AX
576 3564(/*)N
690(allocate)X
1032(buffers)X
1336(for)X
1488(image)X
1716(data)X
1906(*/)X
728 3644(rbuf)N
918(=)X
994(\(short)X
1260 -0.3854(*\)malloc\(image->xsize*sizeof\(short\)\);)AX
728 3724(gbuf)N
918(=)X
994(\(short)X
1260 -0.3854(*\)malloc\(image->xsize*sizeof\(short\)\);)AX
728 3804(bbuf)N
918(=)X
994(\(short)X
1260 -0.3854(*\)malloc\(image->xsize*sizeof\(short\)\);)AX
576 3964(/*)N
690(check)X
918(to)X
1032(see)X
1184(if)X
1298(the)X
1450(image)X
1678(is)X
1792(B/W)X
1944(or)X
2058(RGB)X
2210(*/)X
728 4044 -0.4018(if\(image->zsize)AN
1336(==)X
1450(1\))X
1564({)X
880 4124 -0.4091(printf\("This)AN
1374(is)X
1488(a)X
1564(black)X
1792(and)X
1944(write)X
2172(image0\);)X
880 4204(for\(y=0;)N
1222 -0.4018(y<image->ysize;)AX
1830(y++\))X
2020({)X
1032 4284 -0.3920(getrow\(image,rbuf,y,0\);)AN
1032 4364 -0.4125(printf\("row)AN
1488(%d:)X
1640(",y\);)X
1032 4444(for\(x=0;)N
1374 -0.4018(x<image->xsize;)AX
1982(x++\))X
1184 4524 -0.4167(printf\("%d)AN
9 f
1602(|)X
8 f
1615 -0.4125(",rbuf[x]\);)AX
1032 4604 -0.4125(printf\("0\);)AN
880 4684(})N
728 4764(})N
804(else)X
994 -0.4018(if\(image->zsize)AX
1602(>=)X
1716(3\))X
1830({)X
1944(/*)X
2058(if)X
2172(the)X
2324(image)X
2552(has)X
2704(alpha)X
2932(zsize)X
3160(is)X
3274(4)X
3350(*/)X
880 4844 -0.4091(printf\("This)AN
1374(is)X
1488(a)X
1564(rgb)X
1716(image0\);)X
880 4924(for\(y=0;)N
1222 -0.4018(y<image->ysize;)AX
1830(y++\))X
2020({)X
1032 5004 -0.3920(getrow\(image,rbuf,y,0\);)AN
1032 5084 -0.3920(getrow\(image,gbuf,y,1\);)AN
1032 5164 -0.3920(getrow\(image,bbuf,y,2\);)AN
1032 5244 -0.4125(printf\("row)AN
1488(%d:)X
1640(",y\);)X
1032 5324(for\(x=0;)N
1374 -0.4018(x<image->xsize;)AX
1982(x++\))X
1184 5404 -0.4167(printf\("%d)AN
1602(%d)X
1716(%d)X
9 f
1830(|)X
8 f
1843 -0.3894(",rbuf[x],gbuf[x],bbuf[x]\);)AX
1032 5484 -0.4125(printf\("0\);)AN
880 5564(})N
728 5644(})N
804(})X

3 p
%%Trailer
xt

xs