无法将 ‘System.IO.Stream’ 转换为 ‘SixLabors.ImageSharp.Formats.DecoderOptions’

huangapple go评论136阅读模式
英文:

cannot convert from 'System.IO.Stream' to 'SixLabors.ImageSharp.Formats.DecoderOptions'

问题

我正在使用SixLabors包来调整Azure Blob存储中的图像大小,它在获取参数时显示错误,提示无法从'System.IO.Stream'转换为'SixLabors.ImageSharp.Formats.DecoderOptions'。

这是Visual Studio 2022的代码片段
显示错误的代码片段

我正在跟随Udemy上的一门课程,在这门课程中没有出现这个错误。

英文:

I am using SixLabors package to resize an image in Azure Blob Storage, it showing an error while taking parameters saying cannot convert from 'System.IO.Stream' to 'SixLabors.ImageSharp.Formats.DecoderOptions'.

This is a the code snippet of Visual Studio 2022
Code snippet showing error

i am following a course on udemy, in which this error didn't appear.

答案1

得分: 1

NuGet Package Version 3.0.0 of SixLoader.ImageSharp is giving this error. I Downgraded the package version and it is working.

英文:

The NuGet Package Version 3.0.0 of SixLoader.ImageSharp is giving this error. I Downgraded the package version and it is working.

答案2

得分: 0

In ImageSharp 3.0.0,他们移除了ImageFormat的out参数,而是将其与元数据一起返回。这是PR链接:https://github.com/SixLabors/ImageSharp/pull/2317

这是发布说明:https://sixlabors.com/posts/announcing-imagesharp-300/
详细的发布说明:https://github.com/SixLabors/ImageSharp/releases/tag/v3.0.0

这是新的用法:

IImageFormat format = image.Metadata.DecodedImageFormat;

"image" 是你的SixLabors.ImageSharp.Image image变量,显然。

英文:

In ImageSharp 3.0.0, they removed ImageFormat out params and rather return it with Metadata.
This is the PR: https://github.com/SixLabors/ImageSharp/pull/2317

This is the release notes: https://sixlabors.com/posts/announcing-imagesharp-300/
Detailed release notes: https://github.com/SixLabors/ImageSharp/releases/tag/v3.0.0

This is the new usage:

IImageFormat format = image.Metadata.DecodedImageFormat;

"image" is your SixLabors.ImageSharp.Image image variable, obviously.

huangapple
  • 本文由 发表于 2023年3月9日 19:53:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/75684252.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定