ascii-art README

项目的 README,来自 github.com/0xSero/ascii-art。合并为一个 markdown 文件:README.md。

ascii-art

Turn any photo, sculpture, object or drawing into a figure made of dots on a fixed grid — charcoal ground, two grey tones, rare crimson — then animate it into a seamless loop: disintegration into wind-blown dust, things emerging or growing out of the figure, voids, tentacles, fine-stipple creatures.

This repo is the skill: the method, the engine, and the scripts that do the mechanical parts.

source image ──photo_dots/mask──► dot map (text) ──render_map──► still
                                        │
                                   scene JSON ──build_scene──► self-contained HTML (render(tt))
                                                          └──grab_frames──► PNG frames ──ffmpeg──► MP4

Requirements

pip install numpy scipy pillow scikit-image playwright
python -m playwright install chromium

Quickstart

# 1. image -> dot map.  rows, then the bright/mid percentiles of the subject's own tones
python scripts/photo_dots.py photo.jpg map.txt 52 58 86

# 2. look at the still before anything moves
python scripts/render_map.py map.txt still 0.6

# 3. scene JSON -> animated page
python scripts/build_scene.py examples/scenes/bust-dust.scene.json out.html

# 4. frames, then encode
python scripts/grab_frames.py out.html frames 30 12      # fps, seconds
ffmpeg -framerate 30 -i frames/f%04d.png -c:v libx264 -crf 16 -pix_fmt yuv420p \
       -movflags +faststart piece.mp4

grab_frames.py out.html sheet.png sheet captures a contact sheet instead of frames.

The look

Element Rule
Ground flat #161616, never pure black
Lattice one fixed grid, tall cells (≈19 × 36 px), every still dot on a cell centre
Two tones bright #f2f2f0 (r ≈ 6.5) and dim #70706e (r ≈ 2.85), nudged 7 px down
Accent crimson #dc143c, rare, only on things that move
Grain subject = coarse lattice; visitors, voids, far dust = fine stipple

Coverage matters more than contrast: most subject cells should be bright; dim dots are shadow accents, empty cells are line art (eyes, mouth, the deepest folds).

Tools

Script Purpose
scripts/photo_dots.py IMG OUT ROWS [top% mid%] image → dot map (env BLUR, MIX, ISO)
scripts/render_map.py MAP OUT [scale] map → PNG + SVG
scripts/rotate_map.py MAP DEG SCALE OUT tilt or scale a map on the same grid
scripts/build_scene.py SCENE.json OUT.html scene → animated page (assets/engine.js)
scripts/grab_frames.py HTML OUT|DIR ... contact sheet or all frames, headless

Docs

Examples

examples/scenes/*.json and examples/bust-skull.map.txt are the scenes and dot map of one finished piece. The reference photographs they point at are not included (third-party imagery), so the scenes document structure rather than run as-is; bust-skull.map.txt is enough to build the figure layers.

License

MIT — see LICENSE. It covers this code and text only. Any image you feed the scripts stays yours (or its owner's); nothing here grants rights to it.

ascii-art (0xSero/ascii-art)

正在搜索数据库…

这是什么?一个工具包,可以把照片、雕塑或素描转换成固定网格上的双色点阵图形,再将其制作成无缝循环的视频动画(尘埃消散、生长、空洞、触须)。
这是一个应用程序,还是需要我自己运行的一组脚本?它是一组 Python 和 JavaScript 脚本(一个引擎加上一条由命令行工具组成的流水线),不是图形界面应用,你需要在命令行中手动调用每个脚本。
我该怎样把照片做成这类动画?对图片运行 photodots.py 生成点阵图,用 rendermap.py 将点阵图转换为 PNG/SVG,用 buildscene.py 根据场景 JSON 生成动画 HTML 页面,最后用 grabframes.py 从该页面截取帧或生成接触表(contact sheet)。
在运行之前,我需要先安装哪些东西?Python 3.10+,并安装 numpy、scipy、Pillow 和 scikit-image;带有 Chromium 版本的 Playwright;以及用于将帧编码为视频的 ffmpeg。
我能直接运行示例场景看效果吗?不能开箱即用。附带的示例场景引用了仓库中未包含的第三方照片,因此它们只能说明结构,无法原样运行。
这是面向谁的?面向艺术家和动态设计师,他们希望有一套可复现的方法来制作点阵图形动画,而不必手绘每一帧。
点阵网格实际是什么样子的?由高瘦单元格构成的固定点阵,背景为近黑色(#161616),点以两种灰色呈现(亮色 #f2f2f0,暗色 #70706e),并仅在运动元素上少量使用深红色强调色(#dc143c)。
SKILL.md 是做什么用的?它记录了这种风格背后的创作方法,包括分步流程、运动词汇、循环数学原理,以及创作作品时的检查清单。
渲染需要浏览器吗?需要。场景会被构建为 HTML 页面,并通过 Playwright 的 Chromium 版本以无界面(headless)方式截取,生成帧或接触表。
我输入的图片归谁所有?归你所有。MIT 许可证只涵盖代码和文档,并不涵盖你用这些脚本处理的任何图片。
作者
0xSero
大小
<0.1 MB
星标
274
更新
提交Oct 25
时长
24天
提交 · 90 天