{"id":13595301,"url":"https://github.com/darrenburns/rich-pixels","last_synced_at":"2025-05-16T16:01:23.749Z","repository":{"id":62854976,"uuid":"563115618","full_name":"darrenburns/rich-pixels","owner":"darrenburns","description":"A Rich-compatible library for writing pixel images and ASCII art to the terminal.","archived":false,"fork":false,"pushed_at":"2024-10-18T09:50:15.000Z","size":70,"stargazers_count":285,"open_issues_count":2,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T14:19:52.999Z","etag":null,"topics":["ascii","ascii-art","console","rich","terminal","textual"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darrenburns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-11-07T23:53:36.000Z","updated_at":"2025-03-29T19:14:49.000Z","dependencies_parsed_at":"2023-12-24T14:26:05.525Z","dependency_job_id":"e04b78fe-9c8d-4328-80c2-f88389e64814","html_url":"https://github.com/darrenburns/rich-pixels","commit_stats":{"total_commits":34,"total_committers":9,"mean_commits":"3.7777777777777777","dds":0.5588235294117647,"last_synced_commit":"a0745ebcc26b966d9dbac5875720364ee5c6a1d3"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrenburns%2Frich-pixels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrenburns%2Frich-pixels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrenburns%2Frich-pixels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrenburns%2Frich-pixels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darrenburns","download_url":"https://codeload.github.com/darrenburns/rich-pixels/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578875,"owners_count":21127714,"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","ascii-art","console","rich","terminal","textual"],"created_at":"2024-08-01T16:01:47.304Z","updated_at":"2025-04-12T14:19:59.570Z","avatar_url":"https://github.com/darrenburns.png","language":"Python","funding_links":[],"categories":["Python","Community","Libraries \u0026 SDKs"],"sub_categories":["Third Party Applications","Python"],"readme":"# Rich Pixels\n\nA Rich-compatible library for writing pixel images and other colourful grids to the\nterminal.\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"700\" src=\"https://user-images.githubusercontent.com/5740731/200676207-8e9c9465-628b-40de-ba0b-410612f2bd7c.svg\" /\u003e\n\u003c/p\u003e\n\n## Installation\n\nGet `rich-pixels` from PyPI.\n\n```\npip install rich-pixels\n```\n\n## Basic Usage\n\n### Images\n\n#### Image from a file\n\nYou can load an image file from a path using `from_image_path`:\n\n```python\nfrom rich_pixels import Pixels\nfrom rich.console import Console\n\nconsole = Console()\npixels = Pixels.from_image_path(\"pokemon/bulbasaur.png\")\nconsole.print(pixels)\n```\n\n#### Pillow image object\n\nYou can create a PIL image object yourself and pass it in to `from_image`.\n\n```python\nfrom rich_pixels import Pixels\nfrom rich.console import Console\nfrom PIL import Image\n\nconsole = Console()\n\nwith Image.open(\"path/to/image.png\") as image:\n    pixels = Pixels.from_image(image)\n\nconsole.print(pixels)\n```\n\nUsing this approach means you can modify your PIL `Image` beforehard.\n\n#### ASCII Art\n\nYou can quickly build shapes using a tool like [asciiflow](https://asciiflow.com), and\napply styles the ASCII characters. This provides a quick way of sketching out shapes.\n\n```python\nfrom rich_pixels import Pixels\nfrom rich.console import Console\nfrom rich.segment import Segment\nfrom rich.style import Style\n\nconsole = Console()\n\n# Draw your shapes using any character you want\ngrid = \"\"\"\\\n     xx   xx\n     ox   ox\n     Ox   Ox\nxx             xx\nxxxxxxxxxxxxxxxxx\n\"\"\"\n\n# Map characters to different characters/styles\nmapping = {\n    \"x\": Segment(\" \", Style.parse(\"yellow on yellow\")),\n    \"o\": Segment(\" \", Style.parse(\"on white\")),\n    \"O\": Segment(\" \", Style.parse(\"on blue\")),\n}\n\npixels = Pixels.from_ascii(grid, mapping)\nconsole.print(pixels)\n```\n\n### Using with Textual\n\n`Pixels` can be integrated into [Textual](https://github.com/Textualize/textual)\napplications just like any other Rich renderable.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrenburns%2Frich-pixels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarrenburns%2Frich-pixels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrenburns%2Frich-pixels/lists"}