Horde_Image_Imagick::getImageAtIndex PHP Method

getImageAtIndex() public method

Returns a specific image from the pages of images.
public getImageAtIndex ( integer $index ) : Horde_Image_Imagick
$index integer The index to return.
return Horde_Image_Imagick The requested image
    public function getImageAtIndex($index)
    {
        if ($index >= $this->_imagick->getNumberImages()) {
            throw new Horde_Image_Exception('Image index out of bounds.');
        }
        $currentIndex = $this->_imagick->getIteratorIndex();
        $this->_imagick->setIteratorIndex($index);
        $image = $this->current();
        $this->_imagick->setIteratorIndex($currentIndex);
        return $image;
    }