Is it possible to draw an image in the console using C#?

Viewed 6056

I'm looking for a way to draw an image inside a console window. Similar to how I can call Console.Write("this will display in the console window");. I'm not sure if this is possible or not.

I've played around a little bit without any luck (probably because .NET wants you to use winforms for graphical programming).

Here's a snippet of what I'm trying to do:

using System;
using System.Drawing;

namespace DisplayImage
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var bmp = new Bitmap(100, 100))
            using (var gr = Graphics.FromImage(bmp))
            {
                gr.FillRectangle(Brushes.Orange, new Rectangle(0, 0, bmp.Width, bmp.Height));

                Console.WriteLine("draw image");
                gr.DrawImage(bmp, 1, 1);

                Console.WriteLine("drew image");
            }
        }
    }
}

Is there a way to do this?

Edit

Is there a way to manipulate pixels in a console app? perhaps I could manually read pixels out of an image and draw each individual pixel in a console.

This is just for fun, btw. Not a practical project, just an exercise/exploratory project. Let's hack the console :-)

3 Answers
Related