Both JPEG and GIF store multiple images, look carefully at some jpeg files and you'll see an embedded JPEG-format thumbnail. You can extract the thumbnail with a hex editor, and open it in any JPEG viewer.
Macromedia made their own extended JPEG format which has an alpha channel, used in Flash.
Also, GIF supports a "lossy" mode in some image editors, where it looks for similar strips of pixels, and changes them to a single common strip of pixels so the image compresses better.
A GIF image can be arbitrarily divided into any size of chunks to compose one image, even 8x8, 8x16, or 16x16 pixel blocks.
So the real WTF is this question.