{"id":17218440,"url":"https://github.com/perliedman/raster-blaster","last_synced_at":"2025-04-13T23:36:41.478Z","repository":{"id":57353460,"uuid":"206652974","full_name":"perliedman/raster-blaster","owner":"perliedman","description":"Blast multi-band rasters to a canvas with speed and style.","archived":false,"fork":false,"pushed_at":"2019-12-16T22:46:41.000Z","size":22989,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T13:46:14.648Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.liedman.net/raster-blaster/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perliedman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-05T20:36:16.000Z","updated_at":"2020-12-20T04:40:19.000Z","dependencies_parsed_at":"2022-09-15T16:40:43.824Z","dependency_job_id":null,"html_url":"https://github.com/perliedman/raster-blaster","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fraster-blaster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fraster-blaster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fraster-blaster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fraster-blaster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perliedman","download_url":"https://codeload.github.com/perliedman/raster-blaster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248798973,"owners_count":21163396,"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":[],"created_at":"2024-10-15T03:46:49.790Z","updated_at":"2025-04-13T23:36:41.440Z","avatar_url":"https://github.com/perliedman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raster Blaster\n\nBlast rasters to a canvas with speed and style.\n\nGiven multi-band raster data, for example satellite imagery, this module renders them to a canvas, allowing arbitrary mappings of raster bands to canvas color channels. This makes it easy and fast to make contrast adjustments, calculate vegetation index like NDVI and many other common operations.\n\n[Tiny example of Raster Blaster in action](https://www.liedman.net/raster-blaster/)\n\nUnder the hood, uses WebGL when available for high performance, falling back to standard canvas operations if needed.\n\n_Note_ Work in progress or rather proof of concept, probably not suitable for production at this point.\n\n## Example\n\n```js\nimport { Pipeline, WebGlRenderer, PipelineSteps } from 'RasterBlaster'\n\n// A pipeline is a series of functions that are applied to\n// the raster data before it is rendered to the canvas\nconst pipeline = new Pipeline([\n  // Convert bands to grayscale using a formula;\n  // $r is the incoming \"r\" band\n  new PipelineSteps.GrayScale('$r+$g-$b'),\n  // Apply smoothstep to each channel (r, g, b, a)\n  new PipelineSteps.SmoothstepContrast(0.2, 0.8),\n  // Take the first channel and map its value to rgb values\n  // using a named colormap\n  new PipelineSteps.ColorMap('RdYlGn'),\n  // Set one or more channels directly from raster bands\n  new PipelineSteps.BandsToChannels({ a: 'a' })\n],\n{\n  // Map (arbitrary) band names to their indices\n  bands: 'rgba',\n  dataType: 'Uint8'\n})\n\n// A renderer can render raster data to a canvas using a pipeline\n// By default, the renderer renders to a 256x256 pixel canvas\nconst renderer = new WebGlRenderer()\nconst canvas = document.createElement('canvas')\ncanvas.width = canvas.height = 256\ndocument.body.appendChild(canvas)\n\nrenderer.render(\n  canvas,\n  pipeline, \n  /* Function that returns a promise that resolves to an array of typed arrays, one for each band */\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Fraster-blaster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperliedman%2Fraster-blaster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Fraster-blaster/lists"}