View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

GIF output from IRAF graphing program

Doug Mink wrote on Aug 28, 2009

I want to spit out a gif file to standard output from a graphics program like splot or one of my rvsao tasks to serve over the Web. Is there a way to do this using the g-gif graphcap entry in some way? Ideally, I would like to avoid creating an intermediate file, but I can create and delete one if I have to. I have been using plotutils to capture the Tektronix codes from stdout and translate them to GIF on the fly, but it seems our web security is keeping me from getting at the appropriate shared libraries or something like that. And doing it all within IRAF would be cleaner anyway.

-Doug Mink

Mike Fitzpatrick wrote on Aug 28, 2009

The default for the sgi2gif translator is to write to STDOUT when the input is either from STDIN or there is only one file. So, if this is truly what you want then a slight tweak to the graphcap would look like:


g-gif|UNIX generic interface to multi-frame GIF file generator:\
        :DD=ugif,tmp$sgk,!{ sgidispatch sgi2gif -w $(PX) -h $(PY) \
        -bg 255 255 255 -fg 0 0 0 < $F ; \
        rm $F.[1-8]; }&:MF#8:NF:tc=sgi_image_format:


i.e. remove the -root flag and redirect the $F filename.

Whether this does what you want is another matter: For web display you'll generally need to output some http header text like the mime-type for the client to make sense of it. Since you're presumably already using a script of some kind you might consider just writing to a fixed filename and have the script return the gif file (on stdout if you like). I've never actually tried this from within IRAF so you might check that the binary data on the stdout stream isn't messing up the parent CL session.

Cheers,
-Mike

Last post on Aug 28, 2009