Magick.net: Error: no decode delegate for this image format `' @ error/blob.c/CustomStreamToImage/765

Created on 23 Feb 2018  路  6Comments  路  Source: dlemstra/Magick.NET

This error occurs after updating from 7.4.0 to 7.4.1.
Are there any additional steps required for updates?
The code is attempting to read svg from a url, and output an enlarged version of the image in .png format.

Code Snippet:

Using client As New HttpClient()
    Dim fileStream = Await client.GetStreamAsync(url)
    Dim settings As New MagickReadSettings With {
        .Width = 300,
        .Height = 300,
        .BackgroundColor = MagickColors.Transparent
    }
    Using outputStream As New MemoryStream
        Using image As New MagickImage(fileStream, settings) 'ERROR OCCURS HERE
            image.Format = MagickFormat.Png
            image.Write(outputStream)
            outputStream.Position = 0
            ------
        End Using
    End Using
End Using

Stack Trace:

at ImageMagick.NativeInstance.CheckException(IntPtr exception, IntPtr result)
   at ImageMagick.MagickImage.NativeMagickImage.ReadStream(MagickSettings settings, ReadWriteStreamDelegate reader, SeekStreamDelegate seeker, TellStreamDelegate teller)
   at ImageMagick.MagickImage.Read(Stream stream, MagickReadSettings readSettings, Boolean ping)

Most helpful comment

Not sure why this changed between versions (maybe a bug fix?) but I can explain why you get this error. Magick.NET cannot detect the format from your fileStream. You will need to specify this in the settings.Format so ImageMagick knows how to read the file.

All 6 comments

Is it possible to create a small repository that I can use to reproduce this issue?

I will push something when I get a chance. Code is only local right now.

Here's a gist that can be loaded into an empty project.

Thanks for the sample will try to take a look at it this weekend.

Not sure why this changed between versions (maybe a bug fix?) but I can explain why you get this error. Magick.NET cannot detect the format from your fileStream. You will need to specify this in the settings.Format so ImageMagick knows how to read the file.

No problem.
Thanks for looking into it.

Tested and confirmed working.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zygimantaskazlauskas picture zygimantaskazlauskas  路  3Comments

tttrrryyyyeer picture tttrrryyyyeer  路  6Comments

tttrrryyyyeer picture tttrrryyyyeer  路  6Comments

Webreaper picture Webreaper  路  4Comments

Insire picture Insire  路  3Comments