Skip to content

SKBitmap.Decode returns null when provided WebClient Stream with certain jpg #335

@funkyOne

Description

@funkyOne

Environment:
Windows 10, .NET Core 2.0 Preview 2, [email protected]

SKBitmap.Decode returns null when provided Stream from WebClient for some jpg files.

using (var client = new WebClient())
{
    using (var stream = client.OpenRead(url))
    {
        var bitmap = SKBitmap.Decode(stream); //returns null
    }
}

Interesting enough, the same image will be decoded fine if first downloaded to memory stream. Also works if converted to bytes.

I tried to compare failing/working files, using JPEGSnoop. Found out that the following data is present in the failing files. Not sure if it is exactly the reason, but at least some clue.
image

Please see the repro here:
https://github.com/funkyOne/SkiaSharpStreamIssueRepro

This does seem like a bug. I'm happy to help more, but don't have much expertise in imaging stuff. I can provide more of such images if needed.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions