{"id":48367127,"url":"https://github.com/kayahr/xbrz","last_synced_at":"2026-04-05T15:02:13.056Z","repository":{"id":345862420,"uuid":"1187628548","full_name":"kayahr/xbrz","owner":"kayahr","description":"A high-quality image upscaling filter for creating beautiful HD representations from low-resolution images","archived":false,"fork":false,"pushed_at":"2026-03-29T07:59:40.000Z","size":8239,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-29T10:37:13.797Z","etag":null,"topics":["assemblyscript","image-processing","image-scaling","pixel-art","pixel-scaling","scaling","typescript","upscaling","wasm","xbrz"],"latest_commit_sha":null,"homepage":"https://kayahr.github.io/xbrz/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kayahr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/funding.yml","license":"LICENSE.md","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},"funding":{"github":"kayahr","custom":"https://paypal.me/kayaahr/"}},"created_at":"2026-03-21T00:24:32.000Z","updated_at":"2026-03-29T07:58:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"005e81c4-3ba9-44ec-9d94-af17eb729c3b","html_url":"https://github.com/kayahr/xbrz","commit_stats":null,"previous_names":["kayahr/xbrz"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kayahr/xbrz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Fxbrz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Fxbrz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Fxbrz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Fxbrz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kayahr","download_url":"https://codeload.github.com/kayahr/xbrz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Fxbrz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31439442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T13:13:19.330Z","status":"ssl_error","status_checked_at":"2026-04-05T13:13:17.778Z","response_time":75,"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":["assemblyscript","image-processing","image-scaling","pixel-art","pixel-scaling","scaling","typescript","upscaling","wasm","xbrz"],"created_at":"2026-04-05T15:02:09.466Z","updated_at":"2026-04-05T15:02:13.023Z","avatar_url":"https://github.com/kayahr.png","language":"TypeScript","funding_links":["https://github.com/sponsors/kayahr","https://paypal.me/kayaahr/"],"categories":[],"sub_categories":[],"readme":"# xbrz\n\n[GitHub] | [NPM] | [JSR] | [API Doc]\n\nThis project is a TypeScript port of the [C++ implementation](https://sourceforge.net/projects/xbrz/) of the xBRZ pixel scaling algorithm, originally created by Zenju. The low-level xBRZ part is a WASM module written in [AssemblyScript](https://www.assemblyscript.org/).\n\n\n## Features\n\n* Supports scaling factors 2-6.\n* Supports alpha transparencies.\n* Works in Node.js and browsers.\n* Performance is pretty much the same as the original C++ implementation.\n* The binary WASM module is embedded in JavaScript (~20 KiB), so you don't need to care about how the browser finds and loads the WASM file.\n\n\n## Usage\n\nInstall the library as a dependency in your project:\n\n```\nnpm install @kayahr/xbrz\n```\n\nAnd then use it like this:\n\n```typescript\nimport { Scaler } from \"@kayahr/xbrz\";\n\n// Create a scaler for a given source image size and scale factor\nconst scaler = new Scaler(96, 84, 3);\n\n// Scale the image. Source and target are RGBA pixel\n// data in a Uint8ClampedArray (like `ImageData#data`)\nconst target = scaler.scale(source);\n\n// The configured source and target sizes and the\n// scale factor can be read from the scaler if needed:\nconsole.log(`Source size: ${scaler.sourceWidth} x ${scaler.sourceHeight}`);\nconsole.log(`Scale factor: ${scaler.factor}`);\nconsole.log(`Target size: ${scaler.targetWidth} x ${scaler.targetHeight}`);\n```\n\nNote that each scaler uses a separate WASM module instance with memory created and initialized for the given source size, scale factor, and LUT mode. Each WASM module instance creates and caches a Y'CbCr lookup table for better performance. By default, this uses a 5-bit lookup table (~128 KiB), matching the Rust port. You can opt into the larger 8-bit lookup table (~64 MiB) by setting the `largeLut` option to `true`:\n\n```typescript\nconst preciseScaler = new Scaler(96, 84, 3, { largeLut: true });\n```\n\nIf you do lots of scaling operations with the same settings, it is highly recommended to reuse the scaler instance, especially when you use the large LUT because creating the lookup table takes time and allocates additional memory per scaler.\n\nAlso note that a scaler reuses the target array returned by the `scale` method. So when you use the same scaler to scale multiple images, process the returned target array immediately or create a copy so the content is not overwritten by the next scaling operation.\n\nWASM memory is automatically freed once neither the scaler nor the target array returned by `scale()` (or any other view derived from the same buffer) is referenced anymore.\n\n## Example images\n\nAlso see the [images](https://github.com/kayahr/xbrz/tree/main/src/test/images) directory for examples at more scaling factors. Most of these images were taken from the [Rust port](https://github.com/bell345/xbrz-rs) of xBRZ and are used here for unit testing and comparison purposes.\n\n### Sample 1\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth style=\"text-align: center\"\u003eNearest Neighbor x3\u003c/th\u003e\n    \u003cth style=\"text-align: center\"\u003exBRZ x3\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd width=\"50%\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/sample1-nn-x3.png\" alt=\"Sample one, nearest neighbor scaled 3x\" style=\"width: 573px; height: auto\" /\u003e\u003c/td\u003e\n    \u003ctd width=\"50%\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/sample1-xbrz-5b-x3.png\" style=\"width: 573px; height: auto\" alt=\"Sample one, xBRZ scaled 3x with 5-bit LUT\" /\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n### Sample 2\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth style=\"text-align: center\"\u003eNearest Neighbor x3\u003c/th\u003e\n    \u003cth style=\"text-align: center\"\u003exBRZ x3\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd width=\"50%\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/sample2-nn-x3.png\" alt=\"Sample 2, nearest neighbor scaled 3x\" style=\"width: 573px; height: auto\" /\u003e\u003c/td\u003e\n    \u003ctd width=\"50%\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/sample2-xbrz-5b-x3.png\" alt=\"Sample 2, xBRZ scaled 3x with 5-bit LUT\" style=\"width: 573px; height: auto\" /\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n### Yoshi\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth style=\"text-align: center\"\u003eNearest Neighbor x6\u003c/th\u003e\n    \u003cth style=\"text-align: center\"\u003exBRZ x6\u003c/th\u003e\n    \u003cth style=\"text-align: center\"\u003eNearest Neighbor x6 (Transparent)\u003c/th\u003e\n    \u003cth style=\"text-align: center\"\u003exBRZ x6 (Transparent)\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"width: 25%; text-align: center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/yoshi-nn-x6.png\" alt=\"Yoshi, nearest neighbor scaled 6x\" style=\"width: 132px; height: auto\" /\u003e\u003c/td\u003e\n    \u003ctd style=\"width: 25%; text-align: center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/yoshi-xbrz-5b-x6.png\" alt=\"Yoshi, xBRZ scaled 6x with 5-bit LUT\" style=\"width: 132px; height: auto\" /\u003e\u003c/td\u003e\n    \u003ctd style=\"width: 25%; text-align: center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/yoshi-transparent-nn-x6.png\" alt=\"Transparent Yoshi, nearest neighbor scaled 6x\" style=\"width: 132px; height: auto\" /\u003e\u003c/td\u003e\n    \u003ctd style=\"width: 25%; text-align: center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/kayahr/xbrz/refs/heads/main/src/test/images/yoshi-transparent-xbrz-5b-x6.png\" alt=\"Transparent Yoshi, xBRZ scaled 6x with 5-bit LUT\" style=\"width: 132px; height: auto\" /\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n[API Doc]: https://kayahr.github.io/xbrz/\n[GitHub]: https://github.com/kayahr/xbrz\n[NPM]: https://www.npmjs.com/package/@kayahr/xbrz\n[JSR]: https://jsr.io/@kayahr/xbrz\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayahr%2Fxbrz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkayahr%2Fxbrz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayahr%2Fxbrz/lists"}