CakeFest 2024: The Official CakePHP Conference

Gmagick::compositeimage

(PECL gmagick >= Unknown)

Gmagick::compositeimageある画像を別の画像に合成する

説明

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

ある画像を、別の画像の指定した位置に合成します。

パラメータ

source

合成する画像を保持する Gmagick オブジェクト。

compose

合成演算子。

x

合成する位置の列オフセット。

y

合成する位置の行オフセット。

戻り値

合成した Gmagick オブジェクトを返します。

エラー / 例外

エラー時に GmagickException をスローします。

add a note

User Contributed Notes 2 notes

up
-3
Paul Janik
12 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
-3
wallace Lau kok poh
12 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');

?>
To Top