PHP can also change the background color of ID photos, come and learn!

藏色散人
Release: 2023-04-10 17:04:01
forward
4056 people have browsed it

This article is from the PHP tutorial column to introduce to you how to change the background color of ID photos in PHP, cut out portraits in PHP, and change the background image in PHP. I hope it will be helpful to you!

php ID photo change background color, php portrait cutout, php change background image

The code is as follows:

';
}
function cleancolor($imgid,$color){
    $width = imagesx($imgid);//获取宽
    $height = imagesy($imgid);//获取高
    for($i=0;$i> 16)&0xff;//取R
            $g = ($rgb >> 8)&0xff;//取G
            $b = $rgb&0xff;//取B
            $randr = 1.5;
            $randg = 1;
            $randb=1;
            //蓝色RGB大致的位置。替换成绿色
            if($r=100){
                //如果能够精确的计算出要保留位置的,这里可以写绝对的数字
                if($i>=$width/2 && $i=$height/2 && $k
$old指的是要处理的图片,指定为png格式
$new指的是处理后输出的图片名
$bg指的是背景图
Copy after login

PHP can also change the background color of ID photos, come and learn!

Author:TANKING
Date:2020-05-07
Web:http://www.likeyunba.com/
WeChat:face6009

Recommended study:《 PHP video tutorial

The above is the detailed content of PHP can also change the background color of ID photos, come and learn!. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!