{"id":48270248,"url":"https://github.com/zebbeni/ansipx","last_synced_at":"2026-04-08T01:00:32.498Z","repository":{"id":348594180,"uuid":"1198767878","full_name":"Zebbeni/ansipx","owner":"Zebbeni","description":"A golang library to convert image files to ansi art","archived":false,"fork":false,"pushed_at":"2026-04-02T14:41:53.000Z","size":33,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T22:41:14.648Z","etag":null,"topics":["ansi-art","ascii","ascii-art","bubbletea","bubbletea-tui","gif-animation","image-to-text","text-user-interface"],"latest_commit_sha":null,"homepage":"https://zebbeni.itch.io/ansizalizer","language":"Go","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/Zebbeni.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-01T18:33:40.000Z","updated_at":"2026-04-04T21:10:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"55d00591-8b43-4d57-b860-f5cda890ef5b","html_url":"https://github.com/Zebbeni/ansipx","commit_stats":null,"previous_names":["zebbeni/ansipic"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Zebbeni/ansipx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zebbeni%2Fansipx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zebbeni%2Fansipx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zebbeni%2Fansipx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zebbeni%2Fansipx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zebbeni","download_url":"https://codeload.github.com/Zebbeni/ansipx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zebbeni%2Fansipx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31452901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ansi-art","ascii","ascii-art","bubbletea","bubbletea-tui","gif-animation","image-to-text","text-user-interface"],"created_at":"2026-04-04T22:11:05.780Z","updated_at":"2026-04-07T00:00:23.021Z","avatar_url":"https://github.com/Zebbeni.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansipx\n\nA Go library for converting images to ANSI art. Renders images as colored terminal text using ASCII characters, Unicode block characters, or custom character sets. Supports static images and animated GIFs.\n\n## Demos\n\n### Unicode Half Blocks (default)\n\n\u003cimg width=\"400\" alt=\"image\" src=\"https://github.com/user-attachments/assets/29e28873-0920-4a40-9799-59e667927eb2\" /\u003e\n\n### ASCII Characters\n\n\u003cimg width=\"400\" alt=\"image\" src=\"https://github.com/user-attachments/assets/bdb13e0d-d70b-44cd-8d12-81fe988d24d6\" /\u003e\n\n### Limited Palette with Dithering\n\n\u003cimg width=\"400\" alt=\"image\" src=\"https://github.com/user-attachments/assets/c1bc1ffe-d1bb-4f40-9177-2c79ba747e8d\" /\u003e\n\n## Install\n\n```\ngo get github.com/Zebbeni/ansipx\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/Zebbeni/ansipx\"\n)\n\nfunc main() {\n\t// Render with default settings (Unicode half-blocks, true color, fit 50x40)\n\tresult, err := ansipx.RenderFile(\"photo.png\", ansipx.DefaultOptions())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Print(result)\n}\n```\n\n### With a palette\n\n```go\nopts := ansipx.DefaultOptions()\nopts.TrueColor = false\nopts.Palette = color.Palette{\n\tcolorful.MustParseHex(\"#000000\"),\n\tcolorful.MustParseHex(\"#626262\"),\n\tcolorful.MustParseHex(\"#ffffff\"),\n}\n\nresult, _ := ansipx.RenderFile(\"photo.png\", opts)\nfmt.Print(result)\n```\n\n### ASCII mode\n\n```go\nopts := ansipx.DefaultOptions()\nopts.CharacterMode = ansipx.Ascii\nopts.AsciiCharSet = ansipx.AsciiAll\n\nresult, _ := ansipx.RenderFile(\"photo.png\", opts)\nfmt.Print(result)\n```\n\n### Custom characters\n\n```go\nopts := ansipx.DefaultOptions()\nopts.CharacterMode = ansipx.Custom\nopts.CustomChars = []rune(\".:+#@\")\nopts.SelectionMode = ansipx.DarkVariance // map by brightness (dark to light)\n// opts.SelectionMode = ansipx.LightVariance // map by brightness (light to dark)\n// opts.SelectionMode = ansipx.Repeat        // cycle through chars\n// opts.SelectionMode = ansipx.Random        // pick at random (use RandomSeed for determinism)\n\nresult, _ := ansipx.RenderFile(\"photo.png\", opts)\nfmt.Print(result)\n```\n\n### From an `image.Image`\n\n```go\nimg, _, _ := image.Decode(reader)\nresult, err := ansipx.Render(img, ansipx.DefaultOptions())\n```\n\n### Animated GIFs\n\n```go\nframes, err := ansipx.RenderGIF(\"animation.gif\", ansipx.DefaultOptions())\nif err != nil {\n\tpanic(err)\n}\nfor _, frame := range frames {\n\tfmt.Print(\"\\033[H\") // move cursor to top-left\n\tfmt.Print(frame.Content)\n\ttime.Sleep(frame.Delay)\n}\n```\n\n### Alpha transparency\n\n```go\nopts := ansipx.DefaultOptions()\nopts.OutputAlpha = true          // transparent pixels render as empty space\nopts.AlphaThreshold = 0.5       // pixels with alpha below 0.5 are treated as transparent\nopts.TrimAlpha = true            // crop transparent borders from output\n\nresult, _ := ansipx.RenderFile(\"sprite.png\", opts)\nfmt.Print(result)\n```\n\nWhen alpha is enabled with Unicode block characters, partially transparent cells automatically select the best-fit block character (from the full set of quarter, half, three-quarter, and full blocks) to render only the opaque sub-pixels with foreground color while leaving the transparent portion as background.\n\n### Text style\n\n```go\nopts := ansipx.DefaultOptions()\nopts.TextStyle = ansipx.TextStyle{\n\tBold:      true,\n\tItalic:    true,\n\tUnderline: true,\n}\n\nresult, _ := ansipx.RenderFile(\"photo.png\", opts)\nfmt.Print(result)\n```\n\n### Solid background color\n\n```go\nbg := colorful.MustParseHex(\"#1a1a2e\")\nopts := ansipx.DefaultOptions()\nopts.SolidBackgroundColor = \u0026bg\n\nresult, _ := ansipx.RenderFile(\"photo.png\", opts)\nfmt.Print(result)\n```\n\n## Options\n\n### Size\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `SizeMode` | `SizeMode` | `Fit` | `Fit` preserves aspect ratio, `Fill` crops to fill, `Stretch` fills exact dimensions |\n| `Width` | `int` | `50` | Output width in characters |\n| `Height` | `int` | `40` | Output height in characters |\n| `CharRatio` | `float64` | `0.46` | Terminal character width-to-height ratio |\n\n### Characters\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `CharacterMode` | `CharacterMode` | `Unicode` | `Ascii`, `Unicode`, or `Custom` |\n| `AsciiCharSet` | `AsciiCharSet` | `AsciiAZ` | `AsciiAZ`, `AsciiNums`, `AsciiSpec`, `AsciiAll` |\n| `UnicodeCharSet` | `UnicodeCharSet` | `UnicodeHalf` | `UnicodeFull`, `UnicodeHalf`, `UnicodeQuarter`, `UnicodeShadeLight/Med/Heavy` |\n| `CustomChars` | `[]rune` | `nil` | Characters for custom mode |\n| `SelectionMode` | `SelectionMode` | `DarkVariance` | How chars map to pixels: `DarkVariance`, `LightVariance`, `Repeat`, `Random` |\n| `RandomSeed` | `int64` | `0` | Seed for deterministic Random mode (same seed = same pattern per frame) |\n| `VarianceThreshold` | `float64` | `0` | 0-1: below this normalized variance, render a space instead of a character |\n| `SolidBackgroundColor` | `*colorful.Color` | `nil` | If set, use this as bg for FG-only character modes |\n\n### Color\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `TrueColor` | `bool` | `true` | Use 24-bit RGB. Set `false` for palette mode |\n| `Palette` | `color.Palette` | `nil` | Color palette for palette mode |\n| `AdaptToPalette` | `bool` | `false` | Remap image color range to palette range before matching |\n\n### Adjustments\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `Brightness` | `int` | `0` | Brightness adjustment (-100 to 100) |\n| `Contrast` | `int` | `0` | Contrast adjustment (-100 to 100) |\n\n### Advanced\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `Sampling` | `SamplingFunction` | `NearestNeighbor` | `NearestNeighbor`, `Bicubic`, `Bilinear`, `Lanczos2`, `Lanczos3`, `MitchellNetravali` |\n| `Dithering` | `bool` | `false` | Enable dithering (palette mode only) |\n| `Serpentine` | `bool` | `false` | Use serpentine scanning for error diffusion dithering |\n| `DitherMode` | `DitherMode` | `DitherModeMatrix` | `DitherModeMatrix`, `DitherModeBayer`, `DitherModeClusteredDot` |\n| `DitherMatrix` | `DitherMatrix` | `FloydSteinberg` | Error diffusion matrix (14 options including `Atkinson`, `Burkes`, `Stucki`, etc.) |\n| `BayerSize` | `uint` | `4` | Bayer matrix size (must be power of 2) |\n| `DitherStrength` | `float32` | `1.0` | Dithering strength for Bayer and ClusteredDot modes |\n| `ClusteredDotMatrix` | `ClusteredDotMatrix` | `ClusteredDot4x4` | Clustered dot matrix (13 options) |\n\n### Text Style\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `TextStyle` | `TextStyle` | `{}` | ANSI text attributes: `Bold`, `Italic`, `Underline`, `Strikethrough` |\n\n### Alpha\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `OutputAlpha` | `bool` | `true` | Preserve transparent pixels as spaces |\n| `TrimAlpha` | `bool` | `false` | Crop transparent borders from output |\n| `AlphaThreshold` | `float64` | `0` | 0-1: pixels with alpha below this are treated as transparent (0 = only fully transparent, 1 = all transparent) |\n\n## Dependencies\n\n- [go-colorful](https://github.com/lucasb-eyer/go-colorful) -- color space math\n- [resize](https://github.com/nfnt/resize) -- image resampling\n- [dither](https://github.com/makeworld-the-better-one/dither) -- error diffusion and ordered dithering\n\nNo terminal UI dependencies. Output is raw ANSI escape sequences.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebbeni%2Fansipx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzebbeni%2Fansipx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebbeni%2Fansipx/lists"}