• 大小: 0.86KB
    文件类型: .php
    金币: 1
    下载: 0 次
    发布日期: 2021-01-30
  • 标签: 图片  扫描放大  php  

资源简介

【实例简介】

PHP代码,可以扫描图片,并进行放大

【核心代码】


$img = imagecreatetruecolor($width,$height);
for($y = 0; $y < $height; $y )
{
for($x = 0; $x < $width; $x )
{
$colors_reg = imagecolorsforindex($image, imagecolorat($image, $x/$multiple, $y/$multiple));
$color = imagecolorallocate($img,$colors_reg['red'],$colors_reg['green'],$colors_reg['blue']);

for($i=$y;$i<$multiple $y;$i ){
for($j=$x;$j<$multiple $x;$j ){
imagesetpixel($img,$j,$i,$color);
}
}





$x = $x ($multiple-1);
}
$y = $y ($multiple-1);
}
imagepng($img);


资源截图

代码片段和文件信息

//输出图像数据
function imagepgm($imgurl $filename $multiple=1)
{
header(“content-type:image/png;charset=utf-8“);
header(‘Content-Disposition: attachment;filename=“‘.$filename.‘.png“‘);
$image = imagecreatefrompng($imgurl);
$width = imagesx($image)*$multiple;
$height = imagesy($image)*$multiple;

$img = imagecreatetruecolor($width$height);
for($y = 0; $y < $height; $y++)
{
for($x = 0; $x < $width; $x++)
{
$col

评论

共有 条评论