src/Intervention/Gif/Decoder.php
public function decode()
    {
        $gif = new Decoded;

        // read header
        $gif->setHeader($this->getNextBytes(6));

        // read logocal screen descriptor
        $gif->setlogicalScreenDescriptor($this->getNextBytes(7));

        // read global color table
        if ($gif->hasGlobalColorTable()) {
            $gif->setGlobalColorTable($this->getNextBytes(
                $gif->countGlobalColors() * 3
            ));
        }

        // read body
        while ( ! feof($this->handle)) {

            switch ($this->getNextBytes(1)) {

                case self::EXTENSION_BLOCK_MARKER:
                    $this->decodeExtension($gif);
                    break;

                case self::IMAGE_SEPARATOR:
                    $this->decodeImageDescriptor($gif);
                    $this->decodeImageData($gif);
                    break;

                case self::TRAILER_MARKER:
                    # code...
                    break 2;
                
                default:
                    throw new \Intervention\Image\Exception\NotReadableException(
                        "Unable to decode GIF image."
                    );
                    break;
            }
        }

        return $gif;
    }
public function decode()
    {
        $gif = new Decoded;

        // read header
        $gif->setHeader($this->getNextBytes(6));

        // read logocal screen descriptor
        $gif->setlogicalScreenDescriptor($this->getNextBytes(7));

        // read global color table
        if ($gif->hasGlobalColorTable()) {
            $gif->setGlobalColorTable($this->getNextBytes(
                $gif->countGlobalColors() * 3
            ));
        }

        // read body
        while ( ! feof($this->handle)) {

            switch ($this->getNextBytes(1)) {

                case self::EXTENSION_BLOCK_MARKER:
                    $this->decodeExtension($gif);
                    break;

                case self::IMAGE_SEPARATOR:
                    $this->decodeImageDescriptor($gif);
                    $this->decodeImageData($gif);
                    break;

                case self::TRAILER_MARKER:
                    # code...
                    break 2;
                
                default:
                    throw new \Intervention\Image\Exception\NotReadableException(
                        "Unable to decode GIF image."
                    );
                    break;
            }
        }

        return $gif;
    }
Decode image stream

@return Decoded