Imagick
在线手册:中文 英文
PHP手册

Imagick::setOption

(PECL imagick 2.0.0)

Imagick::setOptionSet an option

说明

bool Imagick::setOption ( string $key , string $value )

Associates one or more options with the wand.

参数

key

value

返回值

成功时返回 TRUE .


Imagick
在线手册:中文 英文
PHP手册
PHP手册 - N: Set an option

用户评论:

alexandre at gaigalas dot net (11-Jul-2011 10:43)

If you want to extract a preview from a PDF file using the CropBox instead of the whole document, setOption() is the right method:

<?php
$handler
= new Imagick();
$handler->setOption('pdf:use-cropbox', 'true');
$handler->readImage($imageFileName);
$handler->thumbnailImage(200, 200, true);
$handler->setImageFormat('jpeg');
$handler->writeImage($destThumbFileName);
?>

It is the equivalent to the -define pdf:use-cropbox=true for the convert command line tool. pdf:use-trimbox is also available.

Note that on my environment the setOption only worked when i called it before the readImage method, which means that you can't pass the filename to the Imagick constructor directly.