如何直接在.NET代码中快速创建虚拟图像

PaN*_*1Me 3 c# random image winforms

如何快速创建带有图标大小的随机图像?我既不想使用Image.FromFile,也不想Image.FromStream

Ant*_*ram 6

int width = 50;
int height = 50;
using (Bitmap bitmap = new Bitmap(width, height))
{

    // do something to the bitmap
    // perhaps use .SetPixel to maybe apply some color

    bitmap.Save("C:\\Temp\\random.bmp");
}
Run Code Online (Sandbox Code Playgroud)