{"id":41651582,"url":"https://github.com/mblode/blue-noise-typescript","last_synced_at":"2026-01-24T16:12:38.557Z","repository":{"id":209148446,"uuid":"717636353","full_name":"mblode/blue-noise-typescript","owner":"mblode","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-11T22:44:52.000Z","size":16567,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T02:18:30.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/mblode.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"mblode"}},"created_at":"2023-11-12T04:11:57.000Z","updated_at":"2026-01-11T22:44:56.000Z","dependencies_parsed_at":"2023-11-25T12:41:14.763Z","dependency_job_id":null,"html_url":"https://github.com/mblode/blue-noise-typescript","commit_stats":null,"previous_names":["mblode/blue-noise-ts","mblode/blue-noise-typescript"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mblode/blue-noise-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fblue-noise-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fblue-noise-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fblue-noise-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fblue-noise-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblode","download_url":"https://codeload.github.com/mblode/blue-noise-typescript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblode%2Fblue-noise-typescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28731223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: 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":[],"created_at":"2026-01-24T16:12:38.054Z","updated_at":"2026-01-24T16:12:38.550Z","avatar_url":"https://github.com/mblode.png","language":"TypeScript","funding_links":["https://github.com/sponsors/mblode"],"categories":[],"sub_categories":[],"readme":"# Blue Noise Dithering\n\n[![npm version](https://img.shields.io/npm/v/blue-noise.svg)](https://www.npmjs.com/package/blue-noise)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA CLI tool to dither images with blue noise, and generate blue noise textures using the void-and-cluster algorithm.\n\n![Dithered profile image](img/matthew-profile-dithered.png)\n\n## What is Blue Noise?\n\nBlue noise distributes pixels evenly, avoiding the clusters and voids of white noise and the repetitive patterns of Bayer dithering. The result is natural-looking dithered images that preserve detail without obvious artefacts.\n\n![Blue noise texture](blue-noise.png)\n\n_64×64 tileable blue noise texture_\n\n## Installation\n\n```bash\n# Install globally\nnpm install -g blue-noise\n\n# Or use directly with npx\nnpx blue-noise \u003cinput-image\u003e\n```\n\n## Usage\n\n```bash\n# Basic usage\nblue-noise \u003cinput-image\u003e\n\n# Custom colours\nblue-noise \u003cinput-image\u003e -f \u003cforeground-hex\u003e -b \u003cbackground-hex\u003e\n```\n\n### Examples\n\n```bash\n# Black and white dithering\nblue-noise photo.jpg\n\n# Custom colours\nblue-noise photo.jpg -f \"#ff0000\" -b \"#ffffff\"\n\n# Resize and adjust contrast\nblue-noise photo.jpg -w 800 -c 1.2\n\n# Use custom noise texture\nblue-noise photo.jpg -n custom-noise.png\n\n# Using npx (no installation required)\nnpx blue-noise photo.jpg -f \"#0000ff\" -b \"#ffff00\"\n```\n\n## CLI Options\n\n### Dithering Command\n\n- `\u003cinput\u003e` - Path to input image (required)\n- `-o, --output \u003cpath\u003e` - Output directory (default: \"output\")\n- `-n, --noise \u003cpath\u003e` - Path to blue noise texture (default: \"./blue-noise.png\")\n- `-f, --foreground \u003chex\u003e` - Foreground colour in hex (default: \"#000000\")\n- `-b, --background \u003chex\u003e` - Background colour in hex (default: \"#ffffff\")\n- `-w, --width \u003cpixels\u003e` - Resize image width\n- `-h, --height \u003cpixels\u003e` - Resize image height\n- `-c, --contrast \u003cvalue\u003e` - Adjust contrast (default: 1.0)\n\n### Generate Command\n\nGenerate custom blue noise textures:\n\n```bash\nblue-noise generate --size 64 --sigma 1.9 --verbose\n```\n\n- `-s, --size \u003cpixels\u003e` - Texture size (8-512, default: 64)\n- `--sigma \u003cvalue\u003e` - Gaussian sigma (1.0-3.0, default: 1.9)\n- `--seed \u003cnumber\u003e` - Random seed for reproducibility\n- `-v, --verbose` - Show generation progress\n\n**Examples:**\n\n```bash\n# Generate 128×128 texture with default settings\nblue-noise generate -s 128\n\n# Generate with custom sigma and seed\nblue-noise generate -s 64 --sigma 2.1 --seed 42\n\n# Generate with verbose output\nblue-noise generate -s 256 -v\n```\n\n## How It Works\n\nEach pixel in the input image is compared against the corresponding blue noise threshold value. If brighter than the threshold, use the background colour; if darker, use the foreground colour. The noise texture tiles seamlessly across the image.\n\n## Generating Blue Noise\n\nUses the **void-and-cluster algorithm** (Ulichney, 1993): identifies clusters and voids using Gaussian blur, then redistributes pixels until evenly spread. Each pixel gets a rank determining its threshold value.\n\nThe texture tiles seamlessly using torus topology. Power-of-two dimensions (64×64, 128×128) use FFT optimisation for ~50% faster generation.\n\n**Performance:** 64×64 in ~2-5s, 128×128 in ~30-60s. Pre-generate textures for production use.\n\n## References\n\n- [Void-and-cluster method for dither array generation](https://doi.org/10.1117/12.152707) - Ulichney (1993)\n- [Dithering with blue noise](https://doi.org/10.1109/5.3288) - Ulichney (1988)\n\n## Additional Resources\n\n- [Ditherpunk](https://surma.dev/lab/ditherpunk/) - Interactive dithering playground\n- [Dithering - Part 1](https://visualrambling.space/dithering-part-1/) - Deep dive into dithering techniques\n- [Dither Asteroids](https://dither.blode.co/) - Dithering asteroids game\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblode%2Fblue-noise-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblode%2Fblue-noise-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblode%2Fblue-noise-typescript/lists"}