Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $im = imagecreatefrompng('img/1.png');
- $overlay = imagecreatefrompng('img/overlay/1.png');
- $color = array(255, 0, 0);
- list($width, $height) = getimagesize('img/overlay/1.png');
- for ($i = 1; $i < $height; $i++) {
- for ($u = 1; $u < $width; $u++) {
- $color_index = imagecolorat($overlay, $u, $i);
- $rgb = imagecolorsforindex($overlay, $color_index);
- if($rgb['alpha'] < 127 ){
- $color2 = imagecolorallocatealpha($overlay, $color[0], $color[1], $color[2], $rgb['alpha']);
- imagesetpixel($overlay, $u, $i, $color2);
- }
- }
- }
- imagepng($im, 'img/overlay/img.png');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement