<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Most efficient way to assign Bitmap to ImageOverlay.ImageFrame in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/most-efficient-way-to-assign-bitmap-to/m-p/1094654#M10401</link>
    <description>&lt;P&gt;There is &lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.UI.RuntimeImage.FromStreamAsync.html" target="_self"&gt;RuntimeImage.FromStreamAsync(stream)&lt;/A&gt; that you can use, but under the covers it unfortunately have to do the same thing, so you're really not saving much. I would however recommend trying JPEG or PNG so you reduce the byte-buffer size, and how much needs to be sent into the native library - while that will create a small overhead for encoding and decoding, it might overall create a small boost in less memory allocation and interop overhead.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Sep 2021 20:17:15 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2021-09-01T20:17:15Z</dc:date>
    <item>
      <title>Most efficient way to assign Bitmap to ImageOverlay.ImageFrame</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/most-efficient-way-to-assign-bitmap-to/m-p/1093013#M10385</link>
      <description>&lt;P&gt;I am using an ImageOverlay to present UAS video on a 3D SceneView.&lt;/P&gt;&lt;P&gt;Whilst this works, I am finding it very resource intensive to convert every frame of video from a System.Drawing.Bitmap to an ImageFrame that I can assign to the ImageOverlay ImageFrame property.&lt;/P&gt;&lt;P&gt;In particular, when working with in memory images, the only constructor for the ImageFrame that I can use seems to be the one that takes a RuntimeImage, and the only constructor I can use for that takes a byte array.&lt;/P&gt;&lt;P&gt;So as every frame of video is received I have to do the following:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;using (var ms = new MemoryStream())&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; VideoFrameBitmap.Save(ms, ImageFormat.Bmp);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ImageAsBytes = ms.ToArray();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;imageOverlay.ImageFrame = new ImageFrame(new RuntimeImage(ImageAsBytes), new Polygon(points));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The call to VideoFrameBitmap.Save method is particularly processor intensive, and means I have to skip frames when processing 4K video. Note I have tried ImageConverter.ConvertTo but it is actually around 6 times slower than using the memory stream!&lt;/P&gt;&lt;P&gt;So my question is, is there another way to update the ImageFrame on an ImageOverlay, from a Bitmap source without having to go through a conversion to a byte Array?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 04:46:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/most-efficient-way-to-assign-bitmap-to/m-p/1093013#M10385</guid>
      <dc:creator>AndrewWilcockson</dc:creator>
      <dc:date>2021-08-27T04:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Most efficient way to assign Bitmap to ImageOverlay.ImageFrame</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/most-efficient-way-to-assign-bitmap-to/m-p/1094654#M10401</link>
      <description>&lt;P&gt;There is &lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.UI.RuntimeImage.FromStreamAsync.html" target="_self"&gt;RuntimeImage.FromStreamAsync(stream)&lt;/A&gt; that you can use, but under the covers it unfortunately have to do the same thing, so you're really not saving much. I would however recommend trying JPEG or PNG so you reduce the byte-buffer size, and how much needs to be sent into the native library - while that will create a small overhead for encoding and decoding, it might overall create a small boost in less memory allocation and interop overhead.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 20:17:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/most-efficient-way-to-assign-bitmap-to/m-p/1094654#M10401</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2021-09-01T20:17:15Z</dc:date>
    </item>
  </channel>
</rss>

