A real-time colored ASCII camera mirror for the terminal, plus a one-shot photo capture.
Built with AVFoundation for camera capture and Metal compute shaders for the per-frame ASCII rendering. Each cell picks its glyph by matching a 6-D shape vector against pre-computed shape vectors for every character, so edges follow the contour of the image instead of getting smeared into pixel-density blobs.
mirror # live camera in the terminal (ctrl-c to exit)
mirror photo -o selfie.png # capture from camera, save as PNG
mirror photo -o selfie.html # ...or as a self-contained HTML page
mirror photo -i photo.jpg -o out.png # render an existing image instead
Shared by both subcommands:
-c, --charset— characters available to the renderer.--font-name— monospace font used to measure glyph shapes; match it to your terminal font.--gamma— how a cell's brightness splits between glyph density and foreground colour.--edge— exponent for the directional + global contrast enhancement.
Photo-only:
-o, --output— output path. Format is chosen by extension (.html,.htm,.png).-i, --input— render an existing image file (PNG, JPEG, HEIC, etc.) instead of capturing from the camera.--columns/--rows— output grid size; rows defaults to whatever preserves the source aspect ratio.
Requires macOS 14+ and Swift 6.
swift build -c release
.build/release/mirror
The shape-vector rendering technique is adapted from Alex Harri's ASCII characters are not pixels.