Page 1 of 1

Color changing and PNG alpha

Posted: Thu Sep 13, 2007 7:12 pm
by Silverwings
I'm trying to write up a little PHP script to allow a user to change a background color and then the color of a PNG with alpha that's sitting on top of it. I found this thread that's somewhat close:

viewtopic.php?t=43130&postdays=0&postorder=asc&start=0

but apparently I don't know enough about what's going on. There, ahsanra was trying to change specific colors in a picture, so I'm hoping that I can cannibalize that code to do what I want, but I'm not sure what does what. I just want to change the whole image to a different color, straight hex value replacement for every pixel... but retain the alpha values. Is that possible, and if so, how?

I'm hoping it'll be the same code for both the background and the image, and that the alpha channel ignores the hex value change. I would greatly appreciate any input that any of you could offer. I did do some searching, so please forgive me if my search-fu is weak. All I could dig up was the aforementioned thread.

Posted: Wed Oct 24, 2007 7:46 am
by Rovas
Try and use the following
http://alexle.net/archives/131 for saving alpha and use the first part of Rob script from here: http://www.php.net/manual/en/function.i ... parent.php