So I've been working with imagecolorallocate() for a while now. I've made a few really helpful scripts that allow me to make just one image in photoshop, for instance an image used for a tab in a website, and then I can specify a hex color and I can make my tab image show up in the browser as any color I want without going back to photoshop. This script checks to see if a color is already allocated and only allocates a new color if it hasn't already been allocated yet like this:
Code: Select all
$color = imagecolorexact($im, $r, $g, $b);
if($color==-1) {
$color = imagecolorallocate($im, $r, $g, $b);
}
Now I'm working on a much bigger project and I need to allocate 16.7 million colors. Can you create more than one color palette for a single image? I would need like 3600 color palettes for a 720p image.

Would I have to allocate 256 colors and then save them somehow? Like, maybe I could break the image up into 16x16 px squares and then recombine the pieces. Any help would be appreciated. Thanks.