gifs make each colour into a letter. if you have a photo, it'll say a,b,c,d for each pixel for example. if they're all the same colour it'll be a,a,a,a which is shortened to 4a.
it works horizontally, so a black line would become 280a instead of a,b,2a,b,c,3d,e etc etc etc etc
(,
Sun 10 Oct 2004, 19:37,
archived)
it works horizontally, so a black line would become 280a instead of a,b,2a,b,c,3d,e etc etc etc etc
The actual codes that end up in a gif that has a solid black line in it would look 1a, 2a, 3a, 4a, 5a, 6a, etc. though I forget why that is.
The gif is treated as one long string, wrapping at the end of lines. (it also clears the code table and starts again every so manybytes codes, 4095 I think.) So if you could align the black scanlines with the sequences of colours that get encoded, you'd get even better compression. This is presumably what lossy gif optimisation does, which is why you get seemingly random bits of horizontal line everywhere on a highly compressed gif.
Since it's sequences of colours that are encoded, you could also potentially optimise the gif using multi-coloured scan lines.
(,
Sun 10 Oct 2004, 19:50,
archived)
The gif is treated as one long string, wrapping at the end of lines. (it also clears the code table and starts again every so many
Since it's sequences of colours that are encoded, you could also potentially optimise the gif using multi-coloured scan lines.