note 116698 added to imagick.contrastimage

From: Date: Thu, 12 Feb 2015 19:14:09 +0000
Subject: note 116698 added to imagick.contrastimage
Groups: php.notes 
Request: Send a blank email to php-notes+get-201710@lists.php.net to get a copy of this message
Both xyking and quickshiftin include errors in their comments. xyking's error is in looping through negative numbers. quickshifting is incorrect in stating that 0 *increases* contrast (it does not - it decreases it). Here is a (tested, working) method to increment or decrement contrast: <?php class Images { public function contrastImage($contrast, $imagePath){ $this->image = new Imagick(); $this->image->readImage($imagePath); if ($contrast > 0){ for ($i = 1; $i < $contrast; $i++){ $this->image->contrastImage(1); } }else if ($contrast <= 0) { for ($i = 0; $i > $contrast; $i--) { $this->image->contrastImage(0); } } } } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 24.150.16.60 ---- Manual Page -- http://php.net/manual/en/imagick.contrastimage.php Edit -- https://master.php.net/note/edit/116698 Del: integrated -- https://master.php.net/note/delete/116698/integrated Del: useless -- https://master.php.net/note/delete/116698/useless Del: bad code -- https://master.php.net/note/delete/116698/bad+code Del: spam -- https://master.php.net/note/delete/116698/spam Del: non-english -- https://master.php.net/note/delete/116698/non-english Del: in docs -- https://master.php.net/note/delete/116698/in+docs Del: other reasons-- https://master.php.net/note/delete/116698 Reject -- https://master.php.net/note/reject/116698 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201710) next »