Dear lazyweb..
Oct. 28th, 2008 10:14 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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..
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..
(no subject)
Date: 2008-10-28 01:33 pm (UTC)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?
(no subject)
Date: 2008-10-28 01:43 pm (UTC)GD::Image->trueColor(1); and it all works :)
Thanks to you and Zanchey for the help