Blank Image Encoded As Data-uri
Answer :
I looked into it and the smallest possible transparent GIF image, encoded as a data-uri, was this:
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
which is what I'm using now.
If you need a transparent image 1x1 pixel, just set this data uri as src default attribute (keep the /// parts, it encodes byte 255, not a comment).
data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw== This is instead a base64 encoding for an image 1x1 white.
data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw== Otherwise you could set data:null and save ~60 extra bytes for each image.
The smallest I've ever seen
data:image/gif;base64,R0lGODlhAQABAAAAACw= update: This seems broken and doesn't work anymore as reported by @bryc, please use the other answers.
Comments
Post a Comment