True color GIF

<a title="By GDallimore (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File%3ASmallFullColourGIF.gif"><img width="128" alt="SmallFullColourGIF" src="https://upload.wikimedia.org/wikipedia/commons/a/aa/SmallFullColourGIF.gif"/></a>

How this Wikipedia example works

GIF uses indexed color, which means an 'image' always consists of LZW-compressed color indices. Color indices need to be combined with a palette to convert into colors:

   Indices                                 R   G   B
                                         +------------+  
123 43 0 0 12 240 180 ---------   +->  0 |            |
 32 35 .. ..                      +->  1 |            |
                                  +->  2 |            |
                                      .. |            |     ----->   R,G,B
                                      .. |            |
                                      .. |            |
                                     255 |            |
                                         +------------+
                                          8-bit palette 

This is how older video hardware worked actually (store a palette in DAC and color indices in the video frame buffer.. then the hardware did the DA-conversion and sent RGB voltage signals to the CRT). Each color itself are fine 'true-colors' only that maximum 256 of them can occur on the screen. This system saved color storage and bandwidth. Today frame buffers are way faster and bigger, store 'direct-color' data, allowing all R/G/B combinations to appear on the screen.

Using multiple images with new palette in the GIF stream can be combined into a bigger image ending up more than 256 colors. This is of course possible, when the rendering device is true color.

The GIF structure, very simplified:

	HEADER
	|
	IMAGE
	|
	IMAGE
	|
	IMAGE
	|
	...

Images are rendered on the 'Logical Screen', I call it canvas, after each other in a sequence.
It has its dimensions, palette and background color index, defined in HEADER.
Theoretically, the canvas is a rectangle of pixels filled with background color before placing images on it.

	+------------------+
	|                  |
	|    A 'blue'      |
	|     canvas       |
	|                  |
	|                  |
	|                  |
	|                  |
	+------------------+

Each image in the GIF stream has it's own dimensions, position, palette and transparent color index and rendered onto the canvas:

	+------------------+
	|   +--------+     |
	|   |        |     |
	|   | image  |     |
	|   |        |     |
	|   +--------+     |
	|                  |
	|      blue        |
	+------------------+

This is legal in GIF: a smaller image drawn on the logical screen.
Additionally, when one image color index is transparent: blue will shown (i.e. image pixel is not drawn). 
Because both the canvas and each image may define different palette, it is possible to compose GIF images with more than 256 colors (on a 'true-color' canvas). 

This sequence was made by the GIF decoder I wrote (...). There are 3x3 smaller images with own palette tiled onto the logical screen canvas - thus showing 1859 colors. BMP output converted to PNG for the web with Image Tools 3.6 from http://imdrops.com/.

Download all these PNG files

This demonstrates as if drawing the images onto a grey canvas:

20151021 A. Tarpai