Conmajia, 2012

Updated on Feb. 18, 2018

What is ASCII art?

It's graphic symbols formed by ASCII characters instead of colorful pixels. ASCII art is an old technique when the network was not that developed as today. Net bandwidth was so limited and expensive those days, that people had to figure out some substitutions for images. Here is an example to show an excited emotion icon \(\rightarrow\) ヾ(≧∇≦*)ゝ.

In this article, I tried to use a brightness-to-character palette to build ASCII art from an pixel-based image.

The core code is less than 50 lines as below.

public static string Generate(Bitmap img, int rowSz, int colSz)
{
StringBuilder sb
= new StringBuilder(
img.Width / colSz * img.Height / rowSz
);
FastBitmap fast
= new FastBitmap(
img
); fast.Lock();
for (int h = 0; h < img.Height / rowSz; h++)
{
int yoffset = h * rowSz;
for (int w = 0; w < img.Width / colSz; w++)
{
int xoffset = w * colSz;
int br = 0; for (int y = 0; y < 10; y++)
for (int x = 0; x < 10; x++)
try
{
Color c = fast.GetPixel(
x + xoffset,
y + yoffset);
br =
br + (int)(c.GetBrightness() * 10);
}
catch
br += 10;
br /= 10;
if (br / 5 < charset.Length)
sb.Append(
charset[br / 5]);
else
sb.Append(' ');
}
sb.AppendLine();
}
fast.Unlock(); return sb.ToString();
}

You can even make this program animated like this:

The End. \(\Box\)

ASCII Art ヾ(≧∇≦*)ゝ的更多相关文章

  1. ASCII Art (English)

    Conmajia, 2012 Updated on Feb. 18, 2018 What is ASCII art? It's graphic symbols formed by ASCII char ...

  2. ASCII Art

    ASCII Art https://npms.io/search?q=ASCII art ASCII Art Text to ASCII Art Generator (TAAG) http://pat ...

  3. Pictures of Ascii Art

    简述 指尖上的艺术 - 通过键盘上韵律般的敲敲打打,一幅幅美轮美奂的艺术作品便跃然于屏. 这样的画作,包含了无穷的创意,糅合了现代计算机科技与传统绘画艺术,难道还有比这更令人陶醉的美妙事物吗? 简述 ...

  4. Python下字符画(ascii art)生成

    之前在b站上看到有人用C写了个脚本把妹抖龙op转换成字符画的形式输出了,感觉比较好玩在下就用python也写了一遍(主要是因为python比较简单好用).这里就这里就不介绍字符画了,因为能搜到这个的肯 ...

  5. Linux/Unix 桌面趣事:文字模式下的 ASCII 艺术与注释绘画

    boxes 命令不仅是一个文本过滤器,同时是一个很少人知道的有趣工具,它可以在输入的文本或者代码周围框上各种ASCII 艺术画.你可以用它快速创建邮件签名,或者在各种编程语言中留下评论块.这个命令可以 ...

  6. linux ascii艺术与ansi艺术

    Linux终端下的ASCII艺术 http://zh.wikipedia.org/zh-tw/%E9%9B%BB%E5%AD%90%E9%81%8A%E6%88%B2%E5%8F%B2 电子游戏史 h ...

  7. UVALive 7324 ASCII Addition (模拟)

    ASCII Addition 题目链接: http://acm.hust.edu.cn/vjudge/contest/127407#problem/A Description Nowadays, th ...

  8. Yahoo! Logo ASCII Animation in 462 bytes of C

    Last week I put together another obfuscated C program and have been urged by my coworkers to post it ...

  9. ASCII 码对应表

    Macron symbol ASCII CODE 238 : HTML entity : [ Home ][ español ] What is my IP address ? your public ...

随机推荐

  1. Sublime Text3插件安装(经典)

    今天我去听数学建模的培训,感觉很有意思,可是我没有报名(QAQ),没有参加培训的报名,不过幸好没有开始选拔比赛 所以我决定学习数学建模方面的知识,要好好学习了! 希望我未来的学弟学妹们!(不要像我这样 ...

  2. C++教程之初识编程

    突然想写一份C++教程,并且此教程会尽量使用通俗语言来描述,进入正题! 如果你从来没有接触过编程语言,希望我的教程能够帮助你! 一.代码示例 ​ 当然我希望你暂时不要纠结我在写什么,把代码贴在前面是想 ...

  3. Java核心技术梳理-集合

    一.前言 在日常开发中,我们经常会碰到需要在运行时才知道对象个数的情况,这种情况不能使用数组,因为数组是固定数量的,这个时候我们就会使用集合,因为集合可以存储数量不确定的对象. 集合类是特别有用的工具 ...

  4. kubernetes实践之二:Kubernetes可视WEB UI Dashboard搭建

    Kubernetes可视WEBUI Dashboard搭建 支持浏览器:火狐 一.Dashboard下载地址 git clone https://github.com/kubernetes/kuber ...

  5. HighChar 案例

    Highchars //前台 <script> $(function () { //showChat(); initChat(); showPie(); initPie(); }) fun ...

  6. UiPath实践经验总结(二)

    1.       UI操作容易受到各种意外的干扰,因此应该缩短UI操作阶段的总体时间.而为了缩短UI操作阶段的总体时间,应该将UI操作尽量放在一起,将后台的各种操作尽量放在UI操作的前后.例如,现在有 ...

  7. [转]MS Excel VBO option missing in Blue Prism

    本文转自:https://stackoverflow.com/questions/48706743/ms-excel-vbo-option-missing-in-blue-prism 问: I am ...

  8. 可能是最全面的G1学习笔记

    引子 最近遇到很多朋友过来咨询G1调优的问题,我自己去年有专门学过一次G1,但是当时只是看了个皮毛,因此自己也有不少问题.总体来讲,对于G1我有几个疑惑,希望能够在这篇文章中得到解决. G1出现的初衷 ...

  9. Percona XtraBackup 8.0, 安装与测试

    Percona XtraBackup 8.0 是Percona XtraBackup新推出了一个针对MySQL8.0的版本,主要是MySQL8.0在Redo 和 数据库字典方面有了新的改进. Xtra ...

  10. MongoDB 运维相关的命令

    1.在线释放内存 use admindb.runCommand({closeAllDatabases:1}) 注:3.2 版本 已经去掉了这个命令了 2.rs.status() 查询复制集状态 3.d ...