我需要使用 Imagick php 创建一个具有特定尺寸(45 厘米宽 x 32 厘米高)的白色背景的图像,并将其复制到我在某个固定位置的文件夹中的图像中。
我可以帮忙吗?
问候并非常感谢
最佳答案
imagecopy就是你需要的功能
裁剪图像示例:
<?php
// Create image instances
$src = imagecreatefromgif('php.gif');
$dest = imagecreatetruecolor(80, 40);
// Copy
imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);
// Output and free from memory
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
如果你只需要添加白色背景imagefill你的职能是:
$image = imagecreatetruecolor(100, 100);
// set background to white
$white = imagecolorallocate($im, 255, 255, 255);
imagefill($image, 0, 0, $white);
关于php - 将图像插入另一个图像 Imagick,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21903367/