getImage(); $iterator = $image->getPixelIterator(); foreach ($iterator as $row => $pixels) { /** * @var $pixel ImagickPixel */ foreach ($pixels as $col => $pixel) { $this->applyPixel($pixel); } $iterator->syncIterator(); } } /** * @param $pixel ImagickPixel */ protected abstract function applyPixel($pixel); }