public function getFrame($frameNumber = null, $width = null, $height = null, $quality = null)
    {
        $framePos = ($frameNumber === null) ? $this->frameNumber : (((int)$frameNumber) - 1);

        // Frame position out of range
        if (!is_numeric($framePos) || $framePos < 0 || $framePos > $this->getFrameCount()) {
            return false;
        }

        $frameTime = round(($framePos / $this->getFrameCount()) * $this->getDuration(), 4);

        $frame = $this->getFrameAtTime($frameTime, $width, $height, $quality);

        // Increment internal frame number
        if ($frameNumber === null) {
            ++$this->frameNumber;
        }

        return $frame;
    }