Composite Displacement

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
DenisFSC
Posts: 2
Joined: 2017-11-12T06:01:42-07:00
Authentication code: 1152

Composite Displacement

Post by DenisFSC » 2017-11-12T06:17:27-07:00

Hi.

(command line) Code:

Code: Select all

composite displace_map.jpg label.jpg -displace 0x10 result.png
(command line) Result:
true
Image


(PHP) Code:

Code: Select all

$Displace = new Imagick("displace_map.jpg");
$Image = new Imagick("label.jpg");

$Image->compositeImage( $Displace, Imagick::COMPOSITE_DISPLACE, 0, 10);

$Image->writeImage("result.jpg");
(PHP) Result:
false
Image


Question:

How to get the same result in PHP?

snibgo
Posts: 10577
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Composite Displacement

Post by snibgo » 2017-11-12T06:44:16-07:00

The x,y arguments to compositeIndex are for offsets. To set displacement values, use

Code: Select all

$Image->setImageArtifact('compose:args', "0x10");
snibgo's IM pages: im.snibgo.com

DenisFSC
Posts: 2
Joined: 2017-11-12T06:01:42-07:00
Authentication code: 1152

Re: Composite Displacement

Post by DenisFSC » 2017-11-12T06:51:45-07:00

Thank you.
The problem is solved.

Post Reply