PHP Conference Nagoya 2025

Imagick::writeImages

(PECL imagick 2 >= 2.3.0, PECL imagick 3)

Imagick::writeImages画像あるいは画像シーケンスを書き込む

説明

public Imagick::writeImages(string $filename, bool $adjoin): bool

画像あるいは画像シーケンスを書き込みます。

パラメータ

filename

adjoin

戻り値

成功した場合に true を返します。

add a note

User Contributed Notes 2 notes

up
5
mbrugue
15 years ago
The second parameter spicifies if the object is write in multipage file (true) or split every page in a single file (false).

Example:

<?php
$multiTIFF
= new Imagick();

$files = scandir($mytifspath);

foreach(
$files as $f )
{
$auxIMG = new Imagick();
$auxIMG->readImage($mytifspath.$f);

$multiTIFF->addImage($auxIMG);
}

//file multi.TIF
$multiTIFF->writeImages('multi.TIF', true);

//files multi-0.TIF, multi-1.TIF, ...
$multiTIFF->writeImages('multi.TIF', false);
?>
up
4
Malou
14 years ago
As mbrugue sugest, the second parameter can also be use to save an animated gif:

<?php
$anim
= new Imagick();

$files = scandir($myFramesPath);

foreach(
$files as $f )
{
$auxIMG = new Imagick();
$auxIMG->readImage($mytifspath.$f);

$anim->addImage($auxIMG);
}

//write animated gif
$anim->writeImages('anim.gif', true);

?>
To Top