我只是试图对位图图像进行编码和解码,但是Image类显然不存在。我要离开this page创建一个解码器。我在
遇到错误Image DrawnImg = new Image();它说无法绑定类型或名称空间,并且我使用的每个导入都无法修复此错误。我在这里缺少什么图书馆?
这里是代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using System.Drawing;
namespace Thompson_BmpDecodeEncode
{
class Thompson_BmpDecodeEndoce
{
static void Main(string[] args)
{
Uri img = new Uri("<FilePath to image.bmp>", UriKind.RelativeOrAbsolute);
BmpBitmapDecoder decoder2 = new BmpBitmapDecoder(img, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource2 = decoder2.Frames[0];
Image drawnImg = new Image();
Console.ReadKey();
}
}
}