Newsgroups: comp.graphics
Path: cantaloupe.srv.cs.cmu.edu!magnesium.club.cc.cmu.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!europa.eng.gtefsd.com!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!concert!sas!mozart.unx.sas.com!sherman
From: sherman@unx.sas.com (Chris Sherman)
Subject: Re: POVray : tga -> rle
Sender: news@unx.sas.com (Noter of Newsworthy Events)
Message-ID: <sherman.736059099@workroom>
Date: Thu, 29 Apr 1993 04:51:39 GMT
References: <ltqp28INNpa7@pageboy.cs.utexas.edu> <1rkkb6$gec@st-james.comp.vuw.ac.nz>
Nntp-Posting-Host: workroom.unx.sas.com
Organization: SAS Institute Inc.
Lines: 77

In <1rkkb6$gec@st-james.comp.vuw.ac.nz> Craig.Humphrey@comp.vuw.ac.nz (Craig Andrew Humphrey) writes:


>In article <ltqp28INNpa7@pageboy.cs.utexas.edu>, jhpark@cs.utexas.edu (Jihun Park) writes:
>>Hello,
>>I have some problem in converting tga file(generated by POVray) to
>>rle file. When I convert, I do not get any warning message. But
>>if I use xloadimage/getx11, something is wrong.

>[edited]

>>I know that I need to install ppmtorle and tgatoppm, but I do not spend
>>time to install them. Even I do not want to generate .rgb from POVray
>>and then convert them to rle, if possible.(.rgb to rle works, but
>>it will mess up my directory with so many files, and it needs 2 more
>>steps to finally convert to rle file. say cat | rawtorle | rleflip )
>>Does any body out there have same experience/problems ?


>Well for starters, why use rle files?  

Exactly...

I didn't want to mess with tga or rle.  So I wrote the following script. 
All you need is the very standard set of pbm utilities. 

This script is a .pov to .jpg converter.  Just run it like this:

  pov2jpg 1280 1024 fred.pov 

You will need to modify the path's in the script to reflect where you put
povray and its include files.  If you have a problem with disk space, you
can use named pipes instead of temporary files.

I hope you find it useful...

----------------------------------------------------------------------------

#!/bin/sh

if [ $# -lt 3 ] ; then
  echo "usage:  $0 width height sourcefile.pov other_options"
  exit
fi

width=$1
height=$2
datafile=$3
shift 3

#basedatafile=`echo $datafile | sed -e "s/\(.*\)\.pov/\1/"`

thedatafile=`basename $datafile` 
basedatafile=`basename $datafile .pov` 
dirdatafile=`dirname $datafile` 

cd $dirdatafile
/afs/rnd.sas.com/u/sherman/pov/povsrc/build/povray \
  +l/afs/rnd.sas.com/u/sherman/pov/povscn/include \
  +o/tmp/data$$ +w${width} +h${height} +fr +i${thedatafile} $*

echo " "
rawtopgm $width $height < /tmp/data$$.grn > /tmp/green$$
rawtopgm $width $height < /tmp/data$$.red > /tmp/red$$
rawtopgm $width $height < /tmp/data$$.blu > /tmp/blue$$
rgb3toppm /tmp/red$$ /tmp/green$$ /tmp/blue$$ | cjpeg > ${basedatafile}.jpg 
rm /tmp/red$$ /tmp/green$$ /tmp/blue$$ /tmp/data$$.grn /tmp/data$$.red \
   /tmp/data$$.blu
echo "Wrote output to ${basedatafile}.jpg"

---------------------------------------------------------------------------

--
     ____/     /     /     __  /    _  _/    ____/
    /         /     /     /   /      /     /          Chris Sherman
   /         ___   /        _/      /          /
 _____/   __/   __/   __/ _\    _____/   _____/           sherman@unx.sas.com
