The file size isn't too bad, but in Safari the rendering time is terrible. You can see it render each block, and it takes about 10 seconds to render the whole thing.
I assume this is because it's not a commonly used feature, so the code paths are only implemented for compliance rather than performance.
It's actually more of a hack to deal with malformed GIFs and goes directly against spec. To address GIFs where each frame has a 0 frame delay, most GIF decoders implement a minimum frame delay value.
GIF performance seems improved in safari, at least in 6.x, though this is just anecdotal evidence. The GIFs with 0.02 second frames (the actual ones, not just the "here's what it looks like under x browser" ones) seem to render with the same frame rate for me in Safari and Chrome now.
He uses mechanism that is inherent in GIF specification and can be used for animation, more than 256 color images or images that do not store image data for empty areas (or any combination). GIF stores sequence of rectangular blocks of image data each with its specified position in resulting image, own palette and optional delay before start of drawing (for animation). Browsers tend to assume that GIFs with multiple blocks with zero delay between them are broken animated GIFs (and enforce some minimum delay), because such files do exist and are certainly more common than GIFs with holes or large numbers of colors.
It may be possible to work around that: the trick they use to get full color is that each animation frame is allowed to have its own 256 color palette. So for each block of 256 colors, you have a single animation frame "played" which colors in only that block (the rest is transparent). Hypothetically, the only reason it renders so slowly is that there's a pause between playing each frame.
Yes, but it seems that delay may not be avoidable. http://nullsleep.tumblr.com/post/16524517190/animated-gif-mi... says Safari does 16 frames per second max. Drawing 32k colors at 256 colors per frame takes 128 frames. At 16 fps, those would take 8 seconds to draw.
I think it would be cool if the gif gradually enhanced the colors, starting out with the 256 colors and filling in details in subsequent passes. The user would just notice the color fidelity increasing. The trouble is that I don't know if gif implements non-looping animation.
It does support non looping animations. The problem is that I am not sure how you would calculate the 'tween frames. I get the first frame, it's just the final image dithered to 255 colors, but what would one of the intermediate frames look like. A small box with a more restrained palate, or would you break the final image into frames based on spectrum?
I would try to maximize the delta(PSNR) per frame, as a first cut. There are also good perceptual difference metrics. I don't know what algorithm to use. Maybe just the absolute difference on each pixel. Or, you could think of groups of colors to enhance if you're willing to grow the size of the image.
Can you not specify that the next frame's colours should be added to the current one's? Then you could do it in only 3 frames total - one for the red, green and blue channels.
I think it's just binary transparency as is widely mentioned by commenters around the web. I found this in the spec:
"viii) Transparency Index - The Transparency Index is such that when encountered, the corresponding pixel of the display device is not modified and processing goes on to the next pixel. The index is present if and only if the Transparency Flag is set to 1."
Convert it to true-color (24-bit) Windows BMP, and it's 141,538 bytes. So the GIF is even larger than the raw RGB values of each and every pixel concatenated together.
I'm on T-Mobile in the UK. This is a T-Mobile mobile broadband dongle.
They do give you the option to get the original image. They do this sub-optimally by injecting javascript into every page I visit. They hijack the alt-text, replacing it with a message that says something like "Shift R improves the quality of this image, Shift A improves the quality of all images on this page".
The IP address they use for the caching / mangling proxy is 1.2.3.X (where X tends to be 9 or 11) - I'm not making that up, they actually use 1.2.3.9 which is a bad idea.
It seems that the block by block thing is not an animation on purpose, it's really how browsers render it (and other programs load only the first frame etc...), because each sub-image is a frame. So not that ideal.
I lost an argument about this years ago. In Uni I learnt that you could create GIFs with more than 256 colours, but when challenged I could find none. And all references in the net mentioned just 256. I was sure but I ended up believing I just had a brainfart or was lied to in class.
The point is that if you render the image in blocks of 16x16, there can only be 256 colors per block, so there can be as many colors in the image as there are pixels. This 217*217 image has some duplicate pixels in the lower and higher values but gets fairly close to that maximum.
"No one tried or needed to generate images with more than 256 colors since they could not be viewed on anything less than high priced graphics workstations."
Except that given this refers to the late 80's, Amigas had been displaying 4096 colors since the mid 80s. Not millions of colours until the early 90s but still a far cry from the 256 colours of the average PC.
(No, gif was not a native datatype, but the Amiga was remarkably ahead of its time with plug-able file formats.)
This is no different than 200 256-color GIFS loaded side by side. Sure, the entire image is 32K colors, but each 16x16 block is limited to 256 colors still.
Plus the forced animation makes it effectively useless.
Well, in a 16x16 block you only have 16x16=256 pixels, so the blocks themselves are basically "true color". Stack blocks and you'll have lossless true color. Of course, this was more interesting before .png support became widespread in browsers.
(Also, I believe you're not restricted to 16x16/256col blocks. If you can fit a pattern of 255 distinct colors + transparency over a larger image, you could stack several frames to create the same effect, without having to drop down to 16x16 local blocks)
This makes me angry with Adobe: I feel cheated that for the past twenty years I could have been making GIF images with more than 256 colors in Photoshop.
It shows on the iPad in Mobile Safari but loads and fills out slowly in a grid of squares in rows and columns of 3 or 4 (I forget). It took about 15 seconds in all to render. Fascinating nonetheless and I learnt something.
I assume this is because it's not a commonly used feature, so the code paths are only implemented for compliance rather than performance.