This method has to be called BEFORE any files are loaded into the Imagick object.
By default, Imagick will incorrectly read CMYK PDFs - it will read each channel as a greyscale page resulting in 4 times the number of pages. By specifying the desired colorspace (usually SRGB) before reading the file, GhostScript will automatically convert it.
<?php
$im = new Imagick();
// set the sampling resolution
$im->setResolution(200,200);
// set the desired format
$im->SetColorspace(Imagick::COLORSPACE_SRGB);
$im->readimage($file['tmp_name']);
?>
PHP.mk документација
Imagick::setColorspace
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Патека
imagick.setcolorspace.php
Локална патека за оваа страница.
Извор
php.net/manual/en
Оригиналниот HTML се реупотребува и локално се стилизира.
Режим
Прокси + превод во позадина
Кодовите, табелите и белешките остануваат читливи во истиот тек.
Референца
imagick.setcolorspace.php
Imagick::setColorspace
Референца за `imagick.setcolorspace.php` со подобрена типографија и навигација.
Imagick::setColorspace
(PECL imagick 3)
Imagick::setColorspace — Set colorspace
= NULL
Sets the global colorspace value for the object. This method is available if Imagick has been compiled against ImageMagick version 6.5.7 or newer.
Параметри
COLORSPACE-
вистинска функција, само прототип за тоа како треба да биде функцијата. COLORSPACE константи
Вратени вредности
Патеката до PHP скриптата што треба да се провери. true на успешен исход.
Errors/Exceptions
Фрла ImagickException при грешка.
Белешки од корисници 2 забелешки
simonjjarrett at gmail dot com ¶
пред 5 години
Т ¶
пред 11 години
Right now this function doesn't appear to do anything, ref: http://stackoverflow.com/q/10739822/2685496
As mentioned in the answer, modulateImage works fine as a replacement for converting to gray scale.
<?php
$image = new Imagick("input.jpg");
$image->modulateImage(100, 0, 100);
$image->writeImage("output.jpg");
$image->clear();
?>