Yeah, it sounds like a color table problem. You probably are in a 256-size 8-bit-palette color-space and are trying to allocate 1000 unique colors. GD by default creates palette-based images. You need to either
- create a TrueColor (24-bit RGB color) image, which requires a newer libgd and GD.pm. See GD.pm home manual under new(), trueColor() and newTrueColor() and search for palette.
- or use colorResolve and colorClosest to map your 1000 objects into the 256 available palette slotes. Rather than use colorAllocation, I use colorResolve(@rgb)||colorClosest(@rgb) in my mk_color() utility function. Just don't let the table fill with 256 shades of brick red first.
The prior-comment about eval'ing trueColor to catch failure to make portable scripts take advantage of new features is right on target for your problem. (
It's also a generalizable strategy for compatibility and extension for other modules and features, too.)
Good luck, enjoy -- I'm having fun with GD, hope you will too.
Bill n1vux
I had a .sig when they wasted usenet bandwidth, now I make it up as I go along.