doouzlrvb01417498 2012-05-15 08:52
浏览 65

php将图片添加到另一个

I would like to change the color of an image with php. if I wanted to make it appear redder applicherei an image on a higher level across an image with a transparent red and more or less high can indicate how the original photo should be red. I can say gd php functions to create an image of a color (RGBA) and apply it to another image? thanks :)

  • 写回答

1条回答 默认 最新

  • dongzha3058 2012-05-15 09:57
    关注

    You can try using GD's imagecopymerge function, which copies one image to another and supports alpha transparency. Something like this should work:

    <?php
    $redimg = imagecreatetruecolor(100, 100);
    $image = imagecreatefrompng('image.png');
    
    // sets background to red
    $red = imagecolorallocate($redimg, 255, 0, 0);
    imagefill($redimg, 0, 0, $red);
    
    // Merge the red image onto the PNG image
    imagecopymerge($image, $redimg, 0, 0, 0, 0, 100, 100, 75);
    
    header('Content-type: image/png');
    imagepng($image);
    imagedestroy($image);
    imagedestroy($redimg);
    ?>
    

    There's more information here.

    评论

报告相同问题?

悬赏问题

  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程