imagecolortransparent: color, but not index dependant
Posted: Sun Oct 10, 2010 2:30 pm
Alright, the problem is as follows. I am trying to create an image via imagecreatetruecolor. Basicly I convert sprite files (sprites as in you see in those 2d sidescrolling beat-em up games) to gif. Even though everything is completely and fully working there is just one thing I just can't seem to fix.
Since those sprites use color palettes they have no transparency, yet the transparency is defined through the first index of the color palette.
Means the parser knows which parts of the image have to be transparent, when rendering.
Now the problem is that imagecolortransparent can only make COLORS transparent, but not specific index colors in the palette. So if there are multiple colors in the palette but with different indexes, the color, since they're the same are both transparent in the end.
So my question is: is it somehow possible to only make specific indexed colors transparent instead of a color itself?
Because if it doesn't I see no other option than to create a complete gif encoder just for this little feature. And I honestly dont want to do that >__>
I could also make it an alpha based image, but i'd like to keep the images filesize small in the end.
Thanks in advance!
Since those sprites use color palettes they have no transparency, yet the transparency is defined through the first index of the color palette.
Means the parser knows which parts of the image have to be transparent, when rendering.
Now the problem is that imagecolortransparent can only make COLORS transparent, but not specific index colors in the palette. So if there are multiple colors in the palette but with different indexes, the color, since they're the same are both transparent in the end.
So my question is: is it somehow possible to only make specific indexed colors transparent instead of a color itself?
Because if it doesn't I see no other option than to create a complete gif encoder just for this little feature. And I honestly dont want to do that >__>
I could also make it an alpha based image, but i'd like to keep the images filesize small in the end.
Thanks in advance!
