{"id":16048987,"url":"https://github.com/devongovett/color-transform","last_synced_at":"2025-03-18T04:31:04.183Z","repository":{"id":23270708,"uuid":"26629268","full_name":"devongovett/color-transform","owner":"devongovett","description":"Streaming image color space transforms","archived":false,"fork":false,"pushed_at":"2015-06-12T17:27:18.000Z","size":152,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-14T06:51:43.178Z","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-14T08:24:23.000Z","updated_at":"2019-01-22T13:56:08.000Z","dependencies_parsed_at":"2022-08-21T22:30:57.498Z","dependency_job_id":null,"html_url":"https://github.com/devongovett/color-transform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fcolor-transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fcolor-transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fcolor-transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fcolor-transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devongovett","download_url":"https://codeload.github.com/devongovett/color-transform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902271,"owners_count":20366259,"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:12:08.330Z","updated_at":"2025-03-18T04:31:03.878Z","avatar_url":"https://github.com/devongovett.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# color-transform\n\nStreaming image color space transforms\n\n## Installation\n\n    npm install color-transform\n\n## Example\n\n```javascript\nvar ColorTransform = require('color-transform');\n\n// Convert a buffer (list of supported transforms below)\nvar rgb = ColorTransform.cmyk2rgb(new Buffer([ 0, 56, 128, 32 ]))\n// =\u003e new Buffer([ 1, 13, 20 ])\n\n// Streaming example. Converts a CMYK JPEG to an RGB PNG\nfs.createReadStream('cmyk.jpg')\n  .pipe(new JPEGDecoder)\n  .pipe(new ColorTransform('rgb'))\n  .pipe(new PNGEncoder)\n  .pipe(fs.createWriteStream('out.png'));\n```\n\n## Supported color spaces\n\n`color-transform` supports transforms between the following color spaces.\nThe only exception is CMYK, which is currently only supported in one direction -\nyou can convert from CMYK to any of the other color spaces, but not to CMYK.\n\n* `'rgb'` - standard RGB\n* `'rgba'` - RGB with alpha\n* `'gray'` - grayspace\n* `'graya'` - grayspace with alpha\n* `'cmyk'` - CMYK\n\n## API\n\nYou can call the conversion functions directly with a buffer to convert, as \nshown in the example. The functions are named by joining the two color spaces\nwith a `2`, such as `rgb2gray`, and `cmyk2rgb`.\n\nYou can also use the streaming API, which is a [pixel-stream](https://github.com/devongovett/pixel-stream).\nThe constructor accepts two parameters: source color space, and destination color space.\nIf you pipe another pixel-stream into `color-transform`, the source color space is optional\nin the constructor since it will be learned from the source stream.\n\nYou don't need to worry about writing to the stream in whole pixel chunks. The ColorTransform stream\nwill automatically buffer if there is a chunk boundary in the middle of a pixel.\n\n```javascript\n// create a stream that converts from cmyk to rgb\nvar s = new ColorTransform('cmyk', 'rgb');\n\n// pipe a stream that happens to be cmyk to an rgb color transform.\nfs.createReadStream('cmyk.jpg')\n  .pipe(new JPEGDecoder)\n  .pipe(new ColorTransform('rgb'))\n  // ...\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fcolor-transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevongovett%2Fcolor-transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fcolor-transform/lists"}