Blank image encoded as data-uri [duplicate]
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.
data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>
Valid and highly compressible. Essentially free if there's another inline svg in the page.