ASCII Art ヾ(≧∇≦*)ゝ
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 ヾ(≧∇≦*)ゝ的更多相关文章
- ASCII Art (English)
Conmajia, 2012 Updated on Feb. 18, 2018 What is ASCII art? It's graphic symbols formed by ASCII char ...
- ASCII Art
ASCII Art https://npms.io/search?q=ASCII art ASCII Art Text to ASCII Art Generator (TAAG) http://pat ...
- Pictures of Ascii Art
简述 指尖上的艺术 - 通过键盘上韵律般的敲敲打打,一幅幅美轮美奂的艺术作品便跃然于屏. 这样的画作,包含了无穷的创意,糅合了现代计算机科技与传统绘画艺术,难道还有比这更令人陶醉的美妙事物吗? 简述 ...
- Python下字符画(ascii art)生成
之前在b站上看到有人用C写了个脚本把妹抖龙op转换成字符画的形式输出了,感觉比较好玩在下就用python也写了一遍(主要是因为python比较简单好用).这里就这里就不介绍字符画了,因为能搜到这个的肯 ...
- Linux/Unix 桌面趣事:文字模式下的 ASCII 艺术与注释绘画
boxes 命令不仅是一个文本过滤器,同时是一个很少人知道的有趣工具,它可以在输入的文本或者代码周围框上各种ASCII 艺术画.你可以用它快速创建邮件签名,或者在各种编程语言中留下评论块.这个命令可以 ...
- 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 ...
- UVALive 7324 ASCII Addition (模拟)
ASCII Addition 题目链接: http://acm.hust.edu.cn/vjudge/contest/127407#problem/A Description Nowadays, th ...
- 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 ...
- ASCII 码对应表
Macron symbol ASCII CODE 238 : HTML entity : [ Home ][ español ] What is my IP address ? your public ...
随机推荐
- IE浏览器下ajax和缓存的那些事儿
项目经理最近返回了一些问题: (客户浏览器为IE11,本地360,谷歌没发现任何问题) 1.加载页面时下拉框中没有数据,关闭之后再打开出现数据: 2.数据保存之后页面没有刷新: 我也是接手别人的项目, ...
- 【CTF 攻略】CTF比赛中关于zip的总结
[CTF 攻略]CTF比赛中关于zip的总结 分享到: --> 本文首发于安全客,建议到原地址阅读,地址:http://bobao.360.cn/ctf/detail/203.html 前言 ...
- Postman-----Response body:JSON value check的使用介绍
Response body:JSON value check :检查Response返回的body的某个字段所对应的值是否与预期结果的值相等 1.直接点击 Response body:JSON ...
- JAVAEE——SpringMVC第一天:介绍、入门程序、架构讲解、SpringMVC整合MyBatis、参数绑定、SpringMVC和Struts2的区别
1. 学习计划 第一天 1.SpringMVC介绍 2.入门程序 3.SpringMVC架构讲解 a) 框架结构 b) 组件说明 4.SpringMVC整合MyBatis 5.参数绑定 a) Sp ...
- js面试题1
1.介绍js的基本数据类型 Undefined.Null.Boolean.Number.String 2.js有哪些内置对象? 数据封装类对象:Object.Array.Boolean.Number ...
- NET微信公众号开发环境搭建(一)-了解微信由来
公众号的应用,开发及调试环境搭建 花生壳要注册 需要二十多块钱 ,还要实名认证,估计要一两天才能审核通过 主要就是在 windows搭建测试环境 1.微信的应用场景 360百科微信简介 ht ...
- python:前端(HTML)+后端(Django)+数据库(MySQL)
1.创建一个html文件用于简单的网页注册demo <!DOCTYPE html> <html lang="en"> <head> <me ...
- jquery.rotate.js实现可选抽奖次数和中奖内容的转盘抽奖代码
需求: 抽奖代码最多可以抽奖5次,而且,每次只会中“2000元理财金”或者“谢谢参与”,其它的不会抽中(哈哈,果然都是套路). 效果如下: 一.页面结构: ? 1 2 3 4 5 6 7 8 9 10 ...
- 为View设置左右切换动画
本文同步自http://javaexception.com/archives/64 问题: 近期的需求中,碰到了一个view切换动画的需求.要实现的是点击按钮,从左到右滑动view,左边的view消失 ...
- Flutter 异常处理之图片篇
背景 说到异常处理,你可能直接会认为不就是 try-catch 的事情,至于写一篇文章单独来说明吗? 如果你是这么想的,那么本篇说不定会给你惊喜哦~ 而且本篇聚焦在图片的异常处理. 场景 学以致用,有 ...