Red_Oddity

11-13-2003, 03:35 AM

Okay, so far it works to a certain extend in the fact that it now finally asks for the Targaman.inc file but, then it wants to open a file and the saveAs() command makes LW crash (eventhough the LScript manual from Bob Hood clearly states this is the way to do it...unless i'm totally missing something as this is copy-paste stuff

process: ifo

{

// called when a frame is completely rendered

moninit(ifo.height) unless runningUnder() == SCREAMERNET;

datum = date();

(d1,d2,d3) = date();

bestandext = strright("00"+d1,2)+strright("00"+d2,2)+strright("0000"+d3,4);

(d1,d2,d3) = time();

bestandext = bestandext + strright("00"+d1,2)+strright("00"+d2,2)+strright("00"+d3,2);

bestandnaam = getdir(PREVIEWSDIR)+ getsep() + "dump" + bestandext + ".tga";

f = TargaMan(bestandnaam);

f.saveAs(bestandnaam);

f.close();

monend() unless runningUnder() == SCREAMERNET;

}

don't mind my spaghetti code btw....

i have a saver that works but is really slow (especially on large images as it just writes out a TGA header and converts every floating point pixel to 8bit integers.

Another problem is, that it doesn't save exactly the same image as a save image from the image viewer would do (a veery small difference is noticable when you substract a normaly saved image with a autosaved image and then jack down the input levels to 0 black, 1 gamma and 2 white (instead of 255)....small detail, i know, but not right either way...

(here's the slow TARGA writer code: )

hs1 = integer(ifo.height / 256);

hs2 = (ifo.height - (256 * hs1));

ws1 = integer(ifo.width / 256);

ws2 = (ifo.width - (256 * ws1));

bits = 24;

f= File(bestandnaam , "wb");

f.writeByte(0); //identsize

f.writeByte(0); //colourmaptype

f.writeByte(2); //imagetype

f.writeByte(0); //colourmapstart

f.writeByte(0);

f.writeByte(0); //colourmaplength

f.writeByte(0);

f.writeByte(bits); //colourmapbits

f.writeByte(0); //xstart

f.writeByte(0);

f.writeByte(0); //ystart

f.writeByte(0);

f.writeByte(ws2); //width

f.writeByte(ws1);

f.writeByte(hs2); //height

f.writeByte(hs1);

f.writeByte(bits); //bits

f.writeByte(0); //descriptor

for(i = ifo.height;i >= 1;--i)

{

for(j = 1;j <= ifo.width;++j)

{

red = integer(round(ifo.red[j,i] * 255,0));

green = integer(round(ifo.green[j,i] * 255,0));

blue = integer(round(ifo.blue[j,i] * 255 ,0));

if (blue > 255)

{

f.writeByte(255);

}

else

{

f.writeByte(blue);

}

if (green > 255)

{

f.writeByte(255);

}

else

{

f.writeByte(green);

}

if (red > 255)

{

f.writeByte(255);

}

else

{

f.writeByte(red);

}

}

}

So...anyone have ANY idea why the darn TargaMan doesn't work???? or how to get it going?

process: ifo

{

// called when a frame is completely rendered

moninit(ifo.height) unless runningUnder() == SCREAMERNET;

datum = date();

(d1,d2,d3) = date();

bestandext = strright("00"+d1,2)+strright("00"+d2,2)+strright("0000"+d3,4);

(d1,d2,d3) = time();

bestandext = bestandext + strright("00"+d1,2)+strright("00"+d2,2)+strright("00"+d3,2);

bestandnaam = getdir(PREVIEWSDIR)+ getsep() + "dump" + bestandext + ".tga";

f = TargaMan(bestandnaam);

f.saveAs(bestandnaam);

f.close();

monend() unless runningUnder() == SCREAMERNET;

}

don't mind my spaghetti code btw....

i have a saver that works but is really slow (especially on large images as it just writes out a TGA header and converts every floating point pixel to 8bit integers.

Another problem is, that it doesn't save exactly the same image as a save image from the image viewer would do (a veery small difference is noticable when you substract a normaly saved image with a autosaved image and then jack down the input levels to 0 black, 1 gamma and 2 white (instead of 255)....small detail, i know, but not right either way...

(here's the slow TARGA writer code: )

hs1 = integer(ifo.height / 256);

hs2 = (ifo.height - (256 * hs1));

ws1 = integer(ifo.width / 256);

ws2 = (ifo.width - (256 * ws1));

bits = 24;

f= File(bestandnaam , "wb");

f.writeByte(0); //identsize

f.writeByte(0); //colourmaptype

f.writeByte(2); //imagetype

f.writeByte(0); //colourmapstart

f.writeByte(0);

f.writeByte(0); //colourmaplength

f.writeByte(0);

f.writeByte(bits); //colourmapbits

f.writeByte(0); //xstart

f.writeByte(0);

f.writeByte(0); //ystart

f.writeByte(0);

f.writeByte(ws2); //width

f.writeByte(ws1);

f.writeByte(hs2); //height

f.writeByte(hs1);

f.writeByte(bits); //bits

f.writeByte(0); //descriptor

for(i = ifo.height;i >= 1;--i)

{

for(j = 1;j <= ifo.width;++j)

{

red = integer(round(ifo.red[j,i] * 255,0));

green = integer(round(ifo.green[j,i] * 255,0));

blue = integer(round(ifo.blue[j,i] * 255 ,0));

if (blue > 255)

{

f.writeByte(255);

}

else

{

f.writeByte(blue);

}

if (green > 255)

{

f.writeByte(255);

}

else

{

f.writeByte(green);

}

if (red > 255)

{

f.writeByte(255);

}

else

{

f.writeByte(red);

}

}

}

So...anyone have ANY idea why the darn TargaMan doesn't work???? or how to get it going?