in reply to Allocating colors with GD

Could be an issue with the color map - investigate GD::Image->trueColor(1) or GD::Image->new(h,w,1) note also, GD::colorAllocate returns -1 if no color is allocated - check your return values - always (regardless whether your working in Perl/C/Java/BrainF*ck/whatever)

You could try allocating more and more colors until colorAllocate starts returning -1 to check the size of your color map - though I think it also depends on the color maps your apps run, leading some apps to declare private color maps

Replies are listed 'Best First'.
Re: Re: Allocating colors with GD
by strat (Canon) on May 19, 2003 at 11:12 UTC
    Some versions of GD (don't know if newer or older) seem not to have the class method trueColor(), so there an error arises. Therefor, I always pack the trueColor call into an eval:
    eval { GD::Image->trueColor(1) }; if ($@) { # e.g. write to log that this method is not existing }

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"