Jump to content

Using GD Library to create an image overlay for colors?


Prismatic

Recommended Posts

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?!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.