Imagick::setOption

(PECL imagick 2.0.0)

Imagick::setOptionSet an option

Description

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

Associates one or more options with the wand.

Parameters

key

value

Return Values

Returns TRUE on success.

Коментарии

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(200200true);
$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.
2011-07-11 17:43:37
http://php5.kiev.ua/manual/ru/imagick.setoption.html
List of options (with key => value) on official imagemagick site:
http://www.imagemagick.org/script/command-line-options.php#define
2015-09-24 17:48:49
http://php5.kiev.ua/manual/ru/imagick.setoption.html
Автор:
Actually setImageArtifact () can be used if setOption () fails, e.g.

$im->setImageartifact ("distort:viewport", "960x540+0-151");

Or maybe setOption () is deprecated.
2020-03-29 22:17:02
http://php5.kiev.ua/manual/ru/imagick.setoption.html
It does not appear to be possible to disable anti-aliasing using the setOption() method as might be expected, and calling the setOption() method like this does not do anything:

$imagick->setOption('antialias', FALSE);

As discussed at https://github.com/Imagick/imagick/issues/83 the correct way to do this appears to be to use the setAntiAlias() method, which is not currently documented in the PHP manual. As an example, to disable anti-aliasing for an image you can do this:

$imagick->setAntiAlias(FALSE);
2024-04-15 17:50:14
http://php5.kiev.ua/manual/ru/imagick.setoption.html

    Поддержать сайт на родительском проекте КГБ