note 84126 added to function.imagick-getpixeliterator

From: Date: Mon, 30 Jun 2008 08:06:20 +0000
Subject: note 84126 added to function.imagick-getpixeliterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-140995@lists.php.net to get a copy of this message
For me it was very helpful to read a article at Mikko's blog. He showed that the PixelIterator is not read-only, if you sync it regularly: <?php /* Create new object with the image */ $im = new Imagick( "strawberry.png" ); /* Get iterator */ $it = $im->getPixelIterator(); /* Loop trough pixel rows */ foreach( $it as $row => $pixels ) { /* For every second row */ if ( $row % 2 ) { /* Loop trough the pixels in the row (columns) */ foreach ( $pixels as $column => $pixel ) { /* Paint every second pixel black*/ if ( $column % 2 ) { $pixel->setColor( "black" ); } } } /* Sync the iterator, this is important to do on each iteration */ $it->syncIterator(); } /* Display the image */ header( "Content-Type: image/png" ); echo $im; ?> ---- Server IP: 217.160.72.57 Probable Submitter: 85.177.89.182 ---- Manual Page -- http://www.php.net/manual/en/function.imagick-getpixeliterator.php Edit -- https://master.php.net/note/edit/84126 Del: integrated -- https://master.php.net/note/delete/84126/integrated Del: useless -- https://master.php.net/note/delete/84126/useless Del: bad code -- https://master.php.net/note/delete/84126/bad+code Del: spam -- https://master.php.net/note/delete/84126/spam Del: non-english -- https://master.php.net/note/delete/84126/non-english Del: in docs -- https://master.php.net/note/delete/84126/in+docs Del: other reasons-- https://master.php.net/note/delete/84126 Reject -- https://master.php.net/note/reject/84126 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140995) next »