theducks: (Default)
theducks ([personal profile] theducks) wrote2008-10-28 10:14 pm
Entry tags:

Dear lazyweb..

So, this Perl script should draw a rainbow - http://theducks.org/gdtest.txt

But it doesn't, it gets to the end of the red -> yellow transition and dies ( see http://theducks.org/gdtest3.cgi ). So you'd think, my loop/if/elsif isn't working correctly.. but when you print the values, they're correct..

Any ideas?

I have a feeling this has bitten me before, and it's memory related, but now I'm not so sure..
ext_54529: (number)

[identity profile] shrydar.livejournal.com 2008-10-28 01:33 pm (UTC)(link)
'This allocates a color with the specified red, green and blue components and returns its index in the color table'

I suspect it's creating an 8-bit paletted image - so once you allocate 256 colours that's your lot.

Try wrapping the colorAllocate in your loop with an if( ($i % 8)==0 ) and see what happens..

Any particular reason for using Perl+GD?

[identity profile] theducks.livejournal.com 2008-10-28 01:43 pm (UTC)(link)
Sonofa.. that is what it was..

GD::Image->trueColor(1); and it all works :)

Thanks to you and Zanchey for the help