title: How to read an SVG file from stream with MagickNet
body: <p>My application allows the user to upload images and send them to the service, which then converts it to another format and sends it back. We are adding support for the SVG file format and I am running into an issue with reading the file from a byte array. </p>
  
  <p>The issue is that when I initialize a MagickImageInfo object with the SVG Stream object, I get this error:</p>
  
  <p>"no decode delegate for this image format '' @ error/blob.c/BlobToImage/355"</p>
  
  <p>I played around with it and am able to get past this error if I instead create a MagickImage object and supply it with an instance of MagickReadSettings where I set the Format to SVG explicitly. </p>
  
  <p>The core problem is that the MagickImage code needs a hint as to what kind of file it is when it's an SVG. For other file types, it seems to be able to infer what kind of file it is. However, while I am able to supply the MagickImage class with what format the file is, the MagickImageInfo class doesn't have any parameters that I can give it to hint at the file type.</p>
  
  <p>One possible solution would be to write the file to disk, then have MagickImageInfo class read the file from disk, but I really don't want to do this as it adds complexity to the service and makes it depend on disk write access.</p>
  
  <p>Relevant code:</p>
  
  <p>Working code:</p>
  
  <pre><code>var readSettings = new MagickReadSettings() { Format = MagickFormat.Svg };
  using (MagickImage image = new MagickImage(stream, readSettings))
  {
      image.Write("C:\test"); // Actual code doesn't write to disk
  }
  </code></pre>
  
  <p>Not working code:</p>
  
  <pre><code>MagickImageInfo info = new MagickImageInfo(stream);
  </code></pre>