是否可以将带有 Alpha 通道的 Windows 位图转换为 MagickImage?

Is it possible to convert a Windows bitmap with an Alpha channel to a MagickImage?

使用 Magick.Net,是否可以将(在内存中)具有 Alpha 通道的 Windows 位图转换为 MagickImage?当我尝试以下操作时,.net 格式 Format32bppPARgb 和 Format32bppARgb 失败,但与 Format24bppRgb 一起工作正常。错误信息是 "no decode delegate for this image format `XWD'".

bmp = New System.Drawing.Bitmap(400, 300, PixelFormat.Format32bppPARgb)
img = New MagickImage(bmp)

由于 ImageMagick 中的错误,您收到此异常。它读取流并尝试确定格式。它错误地决定格式是 XWD 而不是 BMP。我向 ImageMagick 的 GIT 存储库提交了一个补丁来解决这个问题。您的代码将在撰写本文时尚未发布的 Magick.NET 7.0.0.0018 中运行。