Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. $im = imagecreatefrompng('img/1.png');
  2.  
  3. $overlay = imagecreatefrompng('img/overlay/1.png');
  4. $color = array(255, 0, 0);
  5. list($width, $height) = getimagesize('img/overlay/1.png');
  6. for ($i = 1; $i < $height; $i++) {
  7. for ($u = 1; $u < $width; $u++) {
  8. $color_index = imagecolorat($overlay, $u, $i);
  9. $rgb = imagecolorsforindex($overlay, $color_index);
  10. if($rgb['alpha'] < 127 ){
  11. $color2 = imagecolorallocatealpha($overlay, $color[0], $color[1], $color[2], $rgb['alpha']);
  12. imagesetpixel($overlay, $u, $i, $color2);
  13. }
  14. }
  15. }
  16. imagepng($im, 'img/overlay/img.png');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement