刚才发布了BMP2ASCII转换器
我的C#源码可以将图片转换成文本格式的图案,如下:using System;
using System.Drawing;
using System.IO;
namespace BMP2ASCII
{
class Program
{
static void Main(string[] args)
{
char[] ascii = new char[] { '#', '#', '*','*','+','+','+',';',';',':',':',',',',','.','.',' ',' ' };
Bitmap bmp = new Bitmap("C:\\panda.jfif");
string txt = null;
for (int y = 0; y < bmp.Height; y++)
{
for (int x = 0; x < bmp.Width; x++)
{
uint rgb = ((uint)bmp.GetPixel(x, y).ToArgb() & 0xFFFFFF) / 1048576;
//Console.Write(ascii);
txt += ascii;
}
//Console.WriteLine();
txt += "\n";
}
File.WriteAllText(@"C:\Users\khann\Desktop\panda.txt", txt);
Console.ReadLine();
}
}
}特地来分享一下。
牛:D 棒棒哒!
可爱的熊猫! 厉害! simonzhd 发表于 2020-3-9 19:17
牛
谢谢站长,我迟来的回复。 蓝莓糖 发表于 2020-3-9 19:54
棒棒哒!
可爱的熊猫!
是的,特地选的熊猫。 键盘侠的2019 发表于 2020-3-10 15:39
厉害!
哈哈,谢谢了。 后来我又做了一个彩色的转换器。
熊猫装甲车:'( 孤独星球 发表于 2020-3-23 22:57
后来我又做了一个彩色的转换器。
哇!真是厉害!
页:
[1]
2