| Extracted from Pike v7.8 release 866 at 2016-04-05.

[Top]
Image
Image.GIF

# Method Image.GIF.__decode()

Method __decode

  `array __decode()`

Description

  Decodes a GIF image structure down to chunks and

      ({int xsize,int ysize,      // 0: size of image drawing area
        int numcol,               // 2: suggested number of colors
        void|string colortable,   // 3: opt. global colortable
        ({ int aspx, int aspy,    // 4,0: aspect ratio or 0, 0 if not set
           int background }),     //   1: index of background color

  followed by any number these blocks in any order:

        ({ GIF.EXTENSION,         //   0: block identifier
           int extension,         //   1: extension number
           string data })         //   2: extension data

        ({ GIF.RENDER,            //   0: block identifier
           int x, int y,          //   1: position of render
           int xsize, int ysize,  //   3: size of render
           int interlace,         //   5: interlace flag
           void|string colortbl,  //   6: opt. local colortable
           int lzwsize,           //   7: lzw code size
           string lzwdata })      //   8: packed lzw data

  and possibly ended with one of these:

        ({ GIF.ERROR_PREMATURE_EOD })   // premature end-of-data

        ({ GIF.ERROR_TOO_MUCH_DATA,     // data following end marker
           string data })               // (rest of file)

        ({ GIF.ERROR_UNKNOWN_DATA,      // unknown data
           string data })               // (rest of file)

Returns

  the above array

Note

  May throw errors if the GIF header is incomplete or illegal.

  This is in the very advanced sector of the GIF support; please read about how GIF files works.