{"id":16048970,"url":"https://github.com/devongovett/png-stream","last_synced_at":"2025-03-17T16:31:47.829Z","repository":{"id":23376761,"uuid":"26738229","full_name":"devongovett/png-stream","owner":"devongovett","description":"A streaming PNG encoder and decoder","archived":false,"fork":false,"pushed_at":"2017-09-07T03:04:32.000Z","size":1613,"stargazers_count":29,"open_issues_count":3,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-14T08:33:48.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devongovett.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}},"created_at":"2014-11-17T03:26:37.000Z","updated_at":"2022-05-14T18:00:41.000Z","dependencies_parsed_at":"2022-08-21T23:31:13.135Z","dependency_job_id":null,"html_url":"https://github.com/devongovett/png-stream","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/devongovett%2Fpng-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fpng-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fpng-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fpng-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devongovett","download_url":"https://codeload.github.com/devongovett/png-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221696903,"owners_count":16865510,"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-09T00:11:56.359Z","updated_at":"2024-10-27T15:18:01.287Z","avatar_url":"https://github.com/devongovett.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# png-stream\n\nA streaming PNG encoder and decoder for Node and the browser.\nSupports [animated PNGs](https://wiki.mozilla.org/APNG_Specification) and\nnormal still PNGs.\n\n## Installation\n\n    npm install png-stream\n\nFor the browser, you can build using [Browserify](http://browserify.org/).\n\n## Decoding\n\nThis example uses the [concat-frames](https://github.com/devongovett/concat-frames)\nmodule to collect the output of the PNG decoder into an array of frame objects.\n\n```javascript\nvar PNGDecoder = require('png-stream/decoder');\nvar concat = require('concat-frames');\n\n// decode a PNG file to RGB pixels\nfs.createReadStream('in.png')\n  .pipe(new PNGDecoder)\n  .pipe(concat(function(frames) {\n    // frames is an array of frame objects\n    // each one has a `pixels` property containing\n    // the raw RGB pixel data for that frame, as\n    // well as the width, height, etc.\n  }));\n```\n\n## Encoding\n\nYou can encode a PNG by writing or piping pixel data to a `PNGEncoder` stream.\nThe PNG encoder supports writing data in the RGB, RGBA, grayscale (`gray`), \nand grayscale + alpha (`gray`) color spaces.  You can also write data in the\n`indexed` color space by first quantizing it using the [neuquant](https://github.com/devongovett/neuquant)\nmodule.\n\n```javascript\nvar PNGEncoder = require('png-stream/encoder');\nvar neuquant = require('neuquant');\n\n// convert a JPEG to a PNG\nfs.createReadStream('in.jpg')\n  .pipe(new JPEGDecoder)\n  .pipe(new PNGEncoder)\n  .pipe(fs.createWriteStream('out.png'));\n  \n// write indexed data\nfs.createReadStream('in.jpg')\n  .pipe(new JPEGDecoder)\n  .pipe(new neuquant.Stream)\n  .pipe(new PNGEncoder)\n  .pipe(fs.createWriteStream('indexed.png'));\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fpng-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevongovett%2Fpng-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fpng-stream/lists"}