dotnet / dotnet/winforms

Image.FromStream throws "Parameter is not valid" for WebP images

Open
#9,107 1 comment 5 reactions 1 assignee Claimed by @JeremyKuhne View on GitHub
area-System.Drawing
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

According to https://learn.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-constant-image-file-format-constants GDI+ has support for WebP Images. Support was apparently added in the .NET framework [here](https://github.com/dotnet/runtime/issues/70422).

However whenever I say the following:

```
using var stream = file.OpenReadStream();
using var image = Image.FromStream(stream);
```

I get the error:

> ArgumentException: Parameter is not valid.
> System.Drawing.SafeNativeMethods+Gdip.CheckStatus(int status)

This works fine for most of the other image formats (jpg, gif, png etc).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.