MeqDotNet
MeqDotNet

Reputation: 718

how to create 1px X 1px on .Net

I need an image 1px X 1px or empty Jpeg image using c#

Upvotes: 2

Views: 2206

Answers (2)

WestDiscGolf
WestDiscGolf

Reputation: 4108

You can do something like this ..

            var image = new Bitmap(1, 1);
            MemoryStream stream = new MemoryStream();
            image.Save(stream, ImageFormat.Jpeg);
            stream.Position = 0;

And then save the stream to a file.

Hope this helps.

Upvotes: 4

Marcus Johansson
Marcus Johansson

Reputation: 2667

I can't test this right now, but shouldn't this work?

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

Upvotes: 8

Related Questions