javascript - Is data:image/png;base64 the only base64 encoding for the img tag? -


been working in java images web encoded base64 strings. have seen image/png format in img src tags i.e. data:image/png;base64,{enc0d3d_st!ng...} have not seen image/gif or image/jpg. have looked on , read little on base 64 encoding.

furthermore, strip off data:image/png;base64 part in java (android) when doing base64.decode(src, base64.default) looks there no need png in situation. in fact if not strip off "header" bitmapfactory.decodebytearray returns null.

so question is, there other formats other png image encoding on web?

yes are:

data:image/gif

data:image/jpg

etc...

and not images:

data:text/html

the format follow

data:[<media type>][;charset=<character set>][;base64],<data> 

se here https://en.wikipedia.org/wiki/data_uri_scheme

and

http://dataurl.net/#about


Comments