note 124858 added to imagick.setcolorspace
| From: | simonjjarrett at gmail dot com | Date: | Thu, 26 Mar 2020 17:29:55 +0000 |
| Subject: | note 124858 added to imagick.setcolorspace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214380@lists.php.net to get a copy of this message | ||
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']);
?>
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.195 (proxied: 81.109.86.207)
----
Manual Page -- http://php.net/manual/en/imagick.setcolorspace.php
Edit -- https://master.php.net/note/edit/124858
Del: integrated -- https://master.php.net/note/delete/124858/integrated
Del: useless -- https://master.php.net/note/delete/124858/useless
Del: bad code -- https://master.php.net/note/delete/124858/bad+code
Del: spam -- https://master.php.net/note/delete/124858/spam
Del: non-english -- https://master.php.net/note/delete/124858/non-english
Del: in docs -- https://master.php.net/note/delete/124858/in+docs
Del: other reasons-- https://master.php.net/note/delete/124858
Reject -- https://master.php.net/note/reject/124858
Search -- https://master.php.net/manage/user-notes.php