Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在.Net上创建1px 1px_C#_Asp.net_Image_Jpeg - Fatal编程技术网

C# 如何在.Net上创建1px 1px

C# 如何在.Net上创建1px 1px,c#,asp.net,image,jpeg,C#,Asp.net,Image,Jpeg,我需要使用c#的1px X 1px图像或空Jpeg图像我现在无法测试,但这不应该工作吗 (new Bitmap(1,1)).Save(name,ImageFormat.Jpeg); 你可以这样做 var image = new Bitmap(1, 1); MemoryStream stream = new MemoryStream(); image.Save(stream, ImageFormat.Jpeg);

我需要使用c#

的1px X 1px图像或空Jpeg图像我现在无法测试,但这不应该工作吗

(new Bitmap(1,1)).Save(name,ImageFormat.Jpeg);

你可以这样做

            var image = new Bitmap(1, 1);
            MemoryStream stream = new MemoryStream();
            image.Save(stream, ImageFormat.Jpeg);
            stream.Position = 0;
然后将流保存到文件中


希望这能有所帮助。

为什么要使用C#?你不能用你最喜欢的图像编辑器创建一个吗?不,我需要在之后动态恢复它(修改它并用另一个路径存储它)