Unable to load ICO from a Stream or Byte array

Jun 23, 2013 at 11:38 PM
I am using Magick.NET

I am working with ICO files. It appears I can only read an ICO given a file path (string). Attempting to read from a stream or byte array throws the following exception:
MagickMissingDelegateErrorException: "Magick: no decode delegate for this image format `' @ error/blob.c/BlobToImage/361"
This sample code reproduces the problem:
Dim wc As New Net.WebClient
Dim iconPath As String = "http://www.cnn.com/favicon.ico"

'Read from stream -> doesn't work
Dim col1 As New MagickImageCollection(wc.OpenRead(iconPath))

'Read from byte array -> doesn't work
Dim col2 As New MagickImageCollection(wc.DownloadData(iconPath))

'Read from file -> works
Dim col3 As New MagickImageCollection(iconPath)
I don't know a lot about ImageMagick, but I'm assuming that it's getting tripped up because it doesn't know what type of file it's getting, and it's unable to identify the file by content. The only time it works is when it gets a file path, so it can see the file extension. I don't see any way to pass type information to the Stream or Byte() overloads...MagickReadSettings doesn't take a file type. Am I missing something, or is there a way to get this to work?

Thanks in advance,

Jun 24, 2013 at 7:06 AM
You are right, ImageMagick is unable to identity the file. I will add a Format property to MagickReadSettings so you can specify the format before reading the file.
Jun 24, 2013 at 7:07 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 24, 2013 at 1:13 PM
That will be great, thank you!