Question

I noticed that Google's new page preview gets it's images using base64 rather than plain e.g. jpgs or png's

What are the advantages of doing this?

Can base64 encoded images be compressed better during transit?

Or perhaps cached better by the browser or caching proxy?

Is it so they can do one HTTP request and receive the image and information about the image in one hit?

Any other ideas?

[EDIT]

I've just had a thought, maybe it's so google can use their new image format

http://code.google.com/speed/webp/ without support from browsers?

However looking at the string returned (using the fiddler to intercept the http traffic), the string mentions "image/jpeg". Unless some images are returned in webp format.

Was it helpful?

Solution

The image is a data URL that's received from the server as a JSON(-ish) package with some metadata. I presume that packaging both the image data and the metadata into a single request is worth it in terms of caching and performance.

OTHER TIPS

The golden rule for performance is to reduce the number of connections to the server. By using a data URI (image data encoded as base 64), that round trip is reduced. Additionally, if the page is gzipped, then that base 64 data can still benefit from compression.

See http://developer.yahoo.com/performance/rules.html/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top