Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to show bitmap data in html image tag? [duplicate]

Tags:

html

css

Is there a way to show bitmap image data in an HTML element?

For example, you have a regular image that points to a source file like this:

<img src="myImage.png" width="100" height="100" />

Is there something like this:

<img width="100" height="100">
     <data>ABCDEF...</data>
</img>

Where data would be bitmap data or something similar? And if possible if you know if it's recommended or supported in major browsers?

like image 602
1.21 gigawatts Avatar asked Oct 14 '13 21:10

1.21 gigawatts


1 Answers

You could use a data URI:

<img src="data:image/bmp,ABCDEF..." width="100" height="100" />

If you encoded the data in base64, it could look like this:

<img src="data:image/bmp;base64,BASE64DATAGOESHERE..." width="100" height="100" />
like image 147
tckmn Avatar answered Oct 16 '22 08:10

tckmn