如何用PHP技术轻松实现证件照换底色技巧?
- 内容介绍
- 文章标签
- 相关推荐
本文共计549个文字,预计阅读时间需要3分钟。
原文:本文字由PHP教程栏目给大家介绍php证书换底色、php人物抠图、php换背景图方法,希望对您有所帮助!+php证书换底色、php人物抠图、php换背景图+代码如下:
改写后:分享PHP证书换底色、人物抠图、背景图更换技巧,助您轻松实现。详情及代码示例请看以下内容:
本文由PHP教程栏目给大家介绍php证件照换底色、php人像抠图、php换背景图方法,希望对你有所帮助!
php证件照换底色、php人像抠图、php换背景图
代码如下:
<?php //背景图和原图需要保持宽高要保持一样,这里的示例原图用的是蓝色背景 init(); function init(){ $old = '1.png'; $new = '2.png'; //创建一个png透明图 $img = imagecreatefrompng($old); setpng($img,$old,$new); } function setpng($imgid,$filename,$savename){ $bg = 'bg.png';//背景图 $new = imagecreatefrompng($bg);//创建一个png透明图 list($width,$height)=getimagesize($filename);//获取长和宽 $white = imagecolorallocate($imgid,1,155,215);//选择一个替换颜色。
本文共计549个文字,预计阅读时间需要3分钟。
原文:本文字由PHP教程栏目给大家介绍php证书换底色、php人物抠图、php换背景图方法,希望对您有所帮助!+php证书换底色、php人物抠图、php换背景图+代码如下:
改写后:分享PHP证书换底色、人物抠图、背景图更换技巧,助您轻松实现。详情及代码示例请看以下内容:
本文由PHP教程栏目给大家介绍php证件照换底色、php人像抠图、php换背景图方法,希望对你有所帮助!
php证件照换底色、php人像抠图、php换背景图
代码如下:
<?php //背景图和原图需要保持宽高要保持一样,这里的示例原图用的是蓝色背景 init(); function init(){ $old = '1.png'; $new = '2.png'; //创建一个png透明图 $img = imagecreatefrompng($old); setpng($img,$old,$new); } function setpng($imgid,$filename,$savename){ $bg = 'bg.png';//背景图 $new = imagecreatefrompng($bg);//创建一个png透明图 list($width,$height)=getimagesize($filename);//获取长和宽 $white = imagecolorallocate($imgid,1,155,215);//选择一个替换颜色。

