|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-01-05 03:10 UTC] danack@php.net
-Status: Open
+Status: Verified
[2015-01-05 03:10 UTC] danack@php.net
[2015-02-13 20:55 UTC] danack@php.net
-Status: Verified
+Status: Closed
-Assigned To:
+Assigned To: danack
[2015-02-13 20:55 UTC] danack@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 15:00:01 2025 UTC |
Description: ------------ Amazon recently upgraded the Amazon Linux AMI 32 bit to include ImageMagick.i686 0:6.7.8.9-6.14.amzn1 ImageMagick-devel.i686 0:6.7.8.9-6.14.amzn1 This forced us to reinstall imagick so we upgraded to v3.1.2 Just noticed that when shrinking image with scaleImage the attached code does not set to grayscale as it did prior to upgrades. However if you set $t['width'] = 2010 it does convert to grayscale. NexTUmvuchVSXe7Y3ThHidh9lGcj.jpg in our example is 2000x2000 pixel image. We are using PHP 5.3.28 Test script: --------------- $image = new Imagick(); $image->readImage("NexTUmvuchVSXe7Y3ThHidh9lGcj.jpg"); $t['width'] = 200; $oldw = $image->getImageWidth(); $oldh = $image->getImageHeight(); $ratiow = $t['width']/$oldw; $height = round($oldh*$t['width']/$oldw); if ($height<1) $height=1; if ($ratiow>1) { if (!$image->thumbnailImage($t['width'], $height)) throw new Exception("image scaling failed"); } else { if (!$image->scaleImage($t['width'], $height)) throw new Exception("image scaling failed"); } if(!$image->quantizeImage(65536, Imagick::COLORSPACE_GRAY, 0, false, false)) throw new Exception("conversion to grayscale failed"); file_put_contents("NexTUmvuchVSXe7Y3ThHidh9lGcj-w200g1.jpg", $image); $image = new Imagick(); $image->readImage("NexTUmvuchVSXe7Y3ThHidh9lGcj.jpg"); Expected result: ---------------- We expect the image to be converted to grayscale. Actual result: -------------- Image is not converted to grayscale