略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Imagick::writeImages

2024-11-13

Imagick::writeImages

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

Imagick::writeImagesWrites an image or image sequence

说明

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

Writes an image or image sequence.

参数

filename

adjoin

返回值

成功时返回 true

add a noteadd a note

User Contributed Notes 2 notes

up
6
mbrugue
13 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
2
Malou
12 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);

?>

官方地址:https://www.php.net/manual/en/imagick.writeimages.php

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