{"id":20935101,"url":"https://github.com/moimart/fragment-swader","last_synced_at":"2026-05-22T07:35:32.751Z","repository":{"id":57241314,"uuid":"147125299","full_name":"moimart/fragment-swader","owner":"moimart","description":"Do image manipulation with homegrown TypeScript shaders","archived":false,"fork":false,"pushed_at":"2020-02-27T17:10:18.000Z","size":1265,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-30T14:35:50.294Z","etag":null,"topics":["image-manipulation","image-processing","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moimart.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}},"created_at":"2018-09-02T22:07:01.000Z","updated_at":"2020-02-27T17:10:20.000Z","dependencies_parsed_at":"2022-09-07T23:13:16.096Z","dependency_job_id":null,"html_url":"https://github.com/moimart/fragment-swader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/moimart/fragment-swader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moimart%2Ffragment-swader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moimart%2Ffragment-swader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moimart%2Ffragment-swader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moimart%2Ffragment-swader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moimart","download_url":"https://codeload.github.com/moimart/fragment-swader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moimart%2Ffragment-swader/sbom","scorecard":{"id":657118,"data":{"date":"2025-08-11","repo":{"name":"github.com/moimart/fragment-swader","commit":"ded00b4ba8bcf370098191d5503fc469143c61c1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T14:59:02.057Z","repository_id":57241314,"created_at":"2025-08-21T14:59:02.058Z","updated_at":"2025-08-21T14:59:02.058Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33333550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"online","status_checked_at":"2026-05-22T02:00:06.671Z","response_time":265,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["image-manipulation","image-processing","typescript"],"created_at":"2024-11-18T22:13:02.053Z","updated_at":"2026-05-22T07:35:32.716Z","avatar_url":"https://github.com/moimart.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"fragment-swader\n======\n\nDo image manipulation with homegrown TypeScript shaders. \n\nThis was started as a toy but it can serve as foundation for a \nfully \"JS-native\" image manipulation/processing library\n\nIt includes convenience types and GLSL-like functions to help \nwriting or porting existing fragment shaders.\n\nSupports bilinear, nearest-neighbor for texture filtering; Textures \ncan be \"clamp\"ed or \"repeat\"ed\n\nVector types include operations for addition (add), substraction (sub), \nmultiplication (mul), negation (neg) and other helpers to emulate at a \nsmall extent swizzling (for example: vec4 has a rgb property returning a \nvec3; vec2 has a vu returning the reversed coordinates)\n\n# This is very much Work-in-progress! WIP\n\n# Example for a single hader\n\n```\nimport * as $ from 'fragment-swader';\n\n//Actual typescript shader code\nlet myShader: $.Shader = (coords: $.vec2, samplers: Array\u003c$.TextureInfo\u003e) =\u003e {\n    let d = (0.8 - $.distance(coords, $._vec2(.5)));\n    d = $.smoothstep(.2,.6,d);\n    let c = $.textureFetch(samplers[0], coords.mul(2.5),\"repeat\");\n    \n    let color = c.mul(d);\n    color.a = 1;\n    return color;\n}\n\n//Export the resulting framebuffer to a .png file\nasync function _() {\n    // Create shader\n    let s = new ShaderProcess(myShader);\n    s.size = $._vec2(1024, 576).mul(2); //Double the resolution!\n    \n    s.onProgress = (progress: number) =\u003e {\n        process.stdout.write(' Progress: ' + Math.floor(progress*100) + '%\\r');\n\n        if (progress == 1) {\n            console.log(' Progress: 100% Done!');\n        }\n    };\n\n    await s.addTexture('texture.png').catch(err =\u003e console.error(err));\n    \n    s.run();\n    s.extract().png().toFile('test.png', (err, info) =\u003e {\n        err \u0026\u0026 console.log(err);\n    });\n}\n\n//Execute it!\n_();\n```\n\n# Source image \n![alt text](https://i.imgur.com/QauclJr.png \"Original\")\n\n# Result \n\n![alt text](https://i.imgur.com/icIlBwZ.png \"Result\")\n\n# Example for postprocessing (Blur)\n\n```\nimport * as $ from 'fragment-swader';\n\n//uniform value for both shaders\nlet blurValue = 2.2;\n\n// Shader code for first pass\nlet blurrPass1: $.Shader = (coords: $.vec2, samplers: Array\u003c$.TextureInfo\u003e) =\u003e {\n\n    let blurSize = blurValue / samplers[0].size.x;\n\n    let sum:$.vec4 = $._vec4(0,0,0,1);\n\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x - 4.0 * blurSize, coords.y)).mul(0.05));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x - 3.0 * blurSize, coords.y)).mul(0.09));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x - 2.0 * blurSize, coords.y)).mul(0.12));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x - blurSize, coords.y)).mul(0.15));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y)).mul(0.16));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x + blurSize, coords.y)).mul(0.15));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x + 2.0 * blurSize, coords.y)).mul(0.12));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x + 3.0 * blurSize, coords.y)).mul(0.09));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x + 4.0 * blurSize, coords.y)).mul(0.05));\n\n    return sum;\n};\n\n// Shader code for second pass\nlet blurrPass2: $.Shader = (coords: $.vec2, samplers: Array\u003c$.TextureInfo\u003e) =\u003e {\n\n    let blurSize = blurValue / samplers[0].size.y;\n\n    let sum: $.vec4 = $._vec4(0);\n\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y - 4.0 * blurSize)).mul(0.05));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y - 3.0 * blurSize)).mul(0.09));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y - 2.0 * blurSize)).mul(0.12));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y - blurSize)).mul(0.15));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y)).mul(0.16));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y + blurSize)).mul(0.15));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y + 2.0 * blurSize)).mul(0.12));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y + 3.0 + blurSize)).mul(0.09));\n    sum = sum.add($.textureFetch(samplers[0], $._vec2(coords.x, coords.y + 4.0 + blurSize)).mul(0.05));\n\n    sum.a = 1;\n    return sum;\n};\n\n//Setup the postprocessing pipeline, run it and extract the \n//framebuffer to a .png file\n\nasync function _() {\n    let passes = new Array\u003c$.ShaderPass\u003e();\n\n    passes.push({\n        shader:blurrPass1,\n        textures: new Array\u003cstring\u003e(\"texture.png\")\n    });\n\n    passes.push({\n        shader:blurrPass2,\n        textures:new Array\u003cstring\u003e()\n    });\n\n    let postProcess = new $.PostProcess(passes);\n    postProcess.onProgress = (progress: number) =\u003e {\n        process.stdout.write(' Postprocessing Progress: ' + Math.floor(progress * 100) + '%\\r');\n\n        if (progress == 1) {\n            console.log(' Postprocessing Progress: 100% Done!');\n        }\n    };\n    await postProcess.run();\n    postProcess.extract().png().toFile('test-process.png', (err, info) =\u003e {\n        err \u0026\u0026 console.log(err);\n    });\n}\n\nExecute it!\n_();\n```\n\n# Source image \n![alt text](https://i.imgur.com/QauclJr.png \"Original\")\n\n# Result \n\n![alt text](https://i.imgur.com/veG2CMR.png \"Postprocess result\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoimart%2Ffragment-swader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoimart%2Ffragment-swader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoimart%2Ffragment-swader/lists"}