{"id":19407628,"url":"https://github.com/jorgeterence/ascii","last_synced_at":"2026-06-13T02:04:39.577Z","repository":{"id":259121884,"uuid":"859554185","full_name":"JorgeTerence/ascii","owner":"JorgeTerence","description":"CPU-based ascii-art filter utility","archived":false,"fork":false,"pushed_at":"2024-11-07T21:08:27.000Z","size":6474,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-25T01:43:48.364Z","etag":null,"topics":["ascii-art","image-processing","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JorgeTerence.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-18T21:34:50.000Z","updated_at":"2024-11-07T21:08:31.000Z","dependencies_parsed_at":"2024-11-06T03:10:31.537Z","dependency_job_id":null,"html_url":"https://github.com/JorgeTerence/ascii","commit_stats":null,"previous_names":["jorgeterence/ascii"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeTerence%2Fascii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeTerence%2Fascii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeTerence%2Fascii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeTerence%2Fascii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JorgeTerence","download_url":"https://codeload.github.com/JorgeTerence/ascii/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240587541,"owners_count":19825004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii-art","image-processing","rust","rust-lang"],"created_at":"2024-11-10T12:03:16.193Z","updated_at":"2025-11-18T02:04:12.970Z","avatar_url":"https://github.com/JorgeTerence.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ascii\n\nTurn any image (_and soon video_) into ascii art.\n\n![Vagabond ascii art](./.github/assets/musashi-ascii.png)\n\n[_Go to galery_](#galery)\n\n## About\n\nThis project is inspired by a video from the graphics programmer and content creator [Acerola](https://www.youtube.com/@Acerola_t), who made a [video on ascii art](https://youtu.be/gg40RWiaHRY?si=-8QZkvO8Thm2zgVa).\n\nIn a nutshell, the RGB values of a pixel can converge into a luminance value. Sampling the luminance values of an image results in a grayscale image. What this application does is to take this luminance value and use it as an index for a texture map. Ascii characters are used based on how much space their glyphs fill. The image is also downscaled so that the characters are visible from the default scale.\n\n![Luminance texture atlas](https://github.com/user-attachments/assets/52dee645-b5c9-491f-8cd5-85068f8a8590)\n\nThe function used for calculating the luminance value is `sample`:\n\n```rust\nfn sample(data: \u0026Vec\u003cu8\u003e, y: u32, x: u32, width: u32, scale_y: u32, scale_x: u32) -\u003e u32 {\n    let mut sum = 0;\n\n    for i in y..y + scale_y {\n        for j in x..x + scale_x {\n            sum += data[(i * width + j) as usize] as u32;\n        }\n    }\n\n    sum / (scale_x * scale_y)\n}\n```\n\nAfter sampling the luminance, it is used as an index for either the texture atlas or character array, wether the export options are set for text or image:\n\n```rust\nlet avg = sample(\u0026luminance, y, x, width, TILE_SIZE, TILE_SIZE);\nlet mut index = avg / 32;\n\nfor i in 0..TILE_SIZE {\n    for j in 0..TILE_SIZE {\n        let luma = (atlas.get_pixel(TILE_SIZE * index + j, i).0[0] as f32\n            * (index as f32 / 10.0))\n            as u8;\n        canvas.put_pixel(x + j, y + i, Luma([luma]));\n    }\n}\n```\n\n## Installation\n\n```sh\ncargo install --git https://github.com/JorgeTerence/ascii\n```\n\nOr download the executable from the latest release.\n\n## How to use\n\n```sh\nascii path/to/media\n```\n\n### Options\n\n- `-d` or `--display`: Automatically open the output in the system's default media viewer;\n- `-i` or `--invert`: Invert the input media's luminance values;\n- `-o` or `--output`: Set output format; accepts _img_, _txt_ or _video_ (not yet implemented)\n\n## Future plans\n\n- [ ] Edge detection\n- [ ] Support for video formats\n- [ ] Live video from camera stream\n\n## Galery\n\n![Temple ascii art](.github/assets/temple-ascii.png)\n\nPhoto by Kai-Chieh Chan: [https://www.pexels.com/photo/red-and-brown-temple-569893](https://www.pexels.com/photo/red-and-brown-temple-569893)\n\n![In the Court of the Crimson King](.github/assets/court-of-the-crimson-king-ascii.png)\n\n![Division Bell](.github/assets/division-bell-ascii.png)\n\n![Cat biting a sock](.github/assets/nico-sock-ascii.png)\n\n![Cat wearing glasses](.github/assets/nico-glasses-ascii.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgeterence%2Fascii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorgeterence%2Fascii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgeterence%2Fascii/lists"}