title: How to read drawing image (.dwg) from byte array
body: <p>I have one WPF application in which I am uploading autocad drawing files (.dwg), convert it to byte array and save to database. When I read back that file from byte array, I am getting following error :</p>
  
  <pre><code>No imaging component suitable to complete this operation was found.
  </code></pre>
  
  <p>My code to convert in byte array is below :</p>
  
  <pre><code>FileStream fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);
  byte[] data = new byte[fs.Length];
  fs.Read(data, 0, System.Convert.ToInt32(fs.Length));
  fs.Close();
  </code></pre>
  
  <p>I am trying to get image from byte array using below code :</p>
  
  <pre><code>BitmapImage bi = new BitmapImage();
   bi.BeginInit();
   bi.CreateOptions = BitmapCreateOptions.None;
   bi.CacheOption = BitmapCacheOption.Default;
   bi.StreamSource = new MemoryStream(data);
   RenderOptions.SetBitmapScalingMode(bi, BitmapScalingMode.Linear);
   bi.EndInit();
  </code></pre>
  
  <p>Above code works fine for other image files like jpg, png, bmp, gif. but not working for dwg file. Can anybody guide me what's wrong in my code ?</p>
  
  <p>Thanks</p>