How do I re-create Actionscript's ColorTransform with php gd image library to colorize an image?
I'm using a template of sorts, as you can see here: http://i.imgur.com/TtOHa.png
In the game itself, you can choose any color to apply to that, and using actionscript's ColorTransform for red (255, 0, 0) you will get this: http://i.imgur.com/40FoO.png
After searching and testing for a few days, I'm just getting nowhere with this. Using imagefilter with IMG_FILTER_COLORIZE just isn't cutting it. It just ends up tinting it basically, and it needs to fully change the color and keep intact all the different shades from the template.
I thought the best solution would be to loop through each pixel and convert to HSV for the template and use the V value with the new color but it won't work well if you use a darker color to colorize the objec开发者_开发技巧t with. I tried to come up with a formula on just how bright/dark the color should be according to the template but I just can't come up with anything.
精彩评论