コード例 #1
0
 public static void WriteImage(string url)
 {
     using (var webClient = new WebClient())
     {
         var path = Path.GetTempFileName();
         webClient.DownloadFile(url, path);
         ImageConsole.WriteImage((Bitmap)Image.FromFile(path));
     }
 }
コード例 #2
0
        public static void WriteImage(Bitmap source)
        {
            var sMax    = 39;
            var percent = Math.Min(decimal.Divide(sMax, source.Width), decimal.Divide(sMax, source.Height));
            var dSize   = new Size((int)(source.Width * percent), (int)(source.Height * percent));
            var bmpMax  = new Bitmap(source, dSize.Width * 2, dSize.Height);

            for (var i = 0; i < dSize.Height; i++)
            {
                for (var j = 0; j < dSize.Width; j++)
                {
                    ImageConsole.WritePixel(bmpMax.GetPixel(j * 2, i));
                    ImageConsole.WritePixel(bmpMax.GetPixel(j * 2 + 1, i));
                }

                System.Console.WriteLine();
            }

            Console.ResetColor();
        }