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)
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.
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.Formatso ImageMagick knows how to read the file.