略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Gmagick::compositeimage

2024-11-13

Gmagick::compositeimage

(PECL gmagick >= Unknown)

Gmagick::compositeimageComposite one image onto another

说明

public Gmagick::compositeimage(
    Gmagick $source,
    int $COMPOSE,
    int $x,
    int $y
): Gmagick

Composite one image onto another at the specified offset.

参数

source

Gmagick object which holds the composite image.

compose

Composite operator.

x

The column offset of the composited image.

y

The row offset of the composited image.

返回值

The Gmagick object with compositions.

错误/异常

错误时抛出 GmagickException

add a noteadd a note

User Contributed Notes 2 notes

up
0
Paul Janik
10 years ago
The second parameter, $COMPOSE, has 3 usable values:

1 = the image is displayed normally;
2 = the image is displayed on a white background;
3 = the image is display in black on a white background;

Paul.
up
0
wallace Lau kok poh
10 years ago
Quick script for stamping a small image on a large image

#!/usr/bin/php
<?php
//  <wallace@wallacelau.com>
//Instantiate a new Gmagick object
$imgMain = new Gmagick('Torso_F.tiff');

// get the image width
$width = (int) ($imgMain->getimagewidth() /2) - 150;

//Instantiate a barcode img Gmagick object
$imgBarcode = new Gmagick('barcode.jpeg');

//stamp the barcode on top of the Main image
$imgMain->compositeimage($imgBarcode, 1, $width, 150);
//Write the current image at the current state to a file
$imgMain->write('withBarcode.tiff');

?>

官方地址:https://www.php.net/manual/en/gmagick.compositeimage.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3