Prismatic Posted October 29, 2007 Share Posted October 29, 2007 Ok so my title doesn't describe my situation very well I'm sorry I'm creating a script that will generate a user avatar based on some inputted variables, like armor type and color. my biggest hurdle right now is trying to figure out how to add color to a section of an image using GD. Say someone wants their helmet to be green (now, only one part of the helment should be green, the rest should stay grey). I thought about making a mask in photoshop of the area that is to turn color, make that white, and the rest of the image transparent. So you now have 2 images. The greyscale helmet, and the mask that fits OVER the helmet image which you intend to color and blend. Still with me? If so... I've done that. I've got my helmet image, and the mask which covers the areas I want to change color with solid white. Now, my issue is, if I add color to my mask image, and then overlay it, the transparency of the mask is GONE. The whole image becomes green! Only the white is supposed to turn green! How do I preserve transparency?! Quote Link to comment https://forums.phpfreaks.com/topic/75291-using-gd-library-to-create-an-image-overlay-for-colors/ Share on other sites More sharing options...
MadTechie Posted October 30, 2007 Share Posted October 30, 2007 try this User Contributed Notes from php.net http://php.net/manual/en/function.imagecolortransparent.php#78379 Quote Link to comment https://forums.phpfreaks.com/topic/75291-using-gd-library-to-create-an-image-overlay-for-colors/#findComment-380797 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.