theducks: (Default)
[personal profile] theducks
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..

(no subject)

Date: 2008-10-28 01:33 pm (UTC)
ext_54529: (number)
From: [identity profile] shrydar.livejournal.com
'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?

(no subject)

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

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

Thanks to you and Zanchey for the help

April 2023

S M T W T F S
      1
2345678
91011121314 15
16171819202122
23242526272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 8th, 2025 06:35 pm
Powered by Dreamwidth Studios