Wolfram Computation Meets Knowledge

ImageToDataURI

Contributed by: Cody Woodard

Convert an image into a Data URI, suitable for embedding in web documents

ResourceFunction["ImageToDataURI"][image]

convert image into a Data URI, suitable for embedding in web documents

Examples

Basic Examples

Create Data URI from image

In[1]:=
ResourceFunction["ImageToDataURI"][
 ImageResize[ResourceData["Sample Image: White Dog on a Beach"], 25]]
Out[1]=

Create image element from Wolfram Language code

In[2]:=
ExportString[
 XMLElement[
  "img", {"src" -> ResourceFunction["ImageToDataURI"]@
     Rasterize[
      PolyhedronData[Entity["Polyhedron", "RhombicHexecontahedron"], "Graphics3D"], RasterSize -> 50], "alt" -> ""}, {}], "XML"]
Out[2]=

Resource History