<h1>com::mxgraph::mxImageBundle Class Reference</h1><!-- doxytag: class="com::mxgraph::mxImageBundle" -->
<p>Maps from keys to base64 encoded images or file locations. All values must be URLs or use the format data:image/format followed by a comma and the base64 encoded image data, eg. "data:image/gif,XYZ", where XYZ is the base64 encoded image data.
<ahref="#_details">More...</a></p>
<p><ahref="classcom_1_1mxgraph_1_1mxImageBundle-members.html">List of all members.</a></p>
<tableborder="0"cellpadding="0"cellspacing="0">
<tr><tdcolspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Adds the specified entry to the map. <ahref="#ad60ca8c5a514a3864cac932a6b2d64cc"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the value for the given key. <ahref="#a2eb0c5995f3ae3ce1b6bb68eeb48f72b"></a><br/></td></tr>
<p>Maps from keys to base64 encoded images or file locations. All values must be URLs or use the format data:image/format followed by a comma and the base64 encoded image data, eg. "data:image/gif,XYZ", where XYZ is the base64 encoded image data. </p>
<p>To add a new image bundle to an existing graph, the following code is used:</p>
<p><aclass="el"href="classcom_1_1mxgraph_1_1mxImageBundle.html"title="Maps from keys to base64 encoded images or file locations. All values must be URLs...">mxImageBundle</a> bundle = new mxImageBundle(); bundle.PutImage("myImage", "data:image/gif,R0lGODlhEAAQAMIGAAAAAICAAICAgP" + "//AOzp2O3r2////////yH+FUNyZWF0ZWQgd2l0aCBUaGUgR0lNUAAh+QQBCgAHACwAAAAA" + "EAAQAAADTXi63AowynnAMDfjPUDlnAAJhmeBFxAEloliKltWmiYCQvfVr6lBPB1ggxN1hi" + "laSSASFQpIV5HJBDyHpqK2ejVRm2AAgZCdmCGO9CIBADs="); graph.AddImageBundle(bundle);</p>
<p>The image can then be referenced in any cell style using image=myImage.</p>
<p>To convert a given Image to a base64 encoded String, the following code can be used:</p>
<p>MemoryStream ms = new System.IO.MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); byte[] data = ms.ToArray(); Console.WriteLine("base64="+Convert.ToBase64String(data));</p>
<p>The value is decoded in <aclass="el"href="classcom_1_1mxgraph_1_1mxUtils.html#a30ccc3180a67c12649dbba8212918215"title="Loads an image from the local filesystem, a data URI or any other URL.">mxUtils.LoadImage</a>. The keys for images are resolved and the short format above is converted to a data URI in mxGraph.postProcessCellStyle. </p>