{"id":16125753,"url":"https://github.com/dy/image-encode","last_synced_at":"2025-09-12T21:33:10.071Z","repository":{"id":56681092,"uuid":"157018379","full_name":"dy/image-encode","owner":"dy","description":"Encode pixels data to PNG, GIF, BMP, TIF or JPG","archived":false,"fork":false,"pushed_at":"2021-01-15T20:46:56.000Z","size":40,"stargazers_count":24,"open_issues_count":7,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T00:12:21.555Z","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/dy.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":"2018-11-10T20:23:21.000Z","updated_at":"2024-11-21T09:46:33.000Z","dependencies_parsed_at":"2022-08-15T23:10:42.224Z","dependency_job_id":null,"html_url":"https://github.com/dy/image-encode","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/dy%2Fimage-encode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fimage-encode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fimage-encode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fimage-encode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dy","download_url":"https://codeload.github.com/dy/image-encode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232792146,"owners_count":18577261,"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-09T21:31:31.004Z","updated_at":"2025-01-06T21:53:44.095Z","avatar_url":"https://github.com/dy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# image-encode [![unstable](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dy/image-encode.svg)](https://travis-ci.org/dy/image-encode)\n\nEncode image data to a container: PNG, GIF, BMP, JPEG or TIFF. Uses set of encoders in node and Canvas2D in browser.\n\n## Usage\n\n[![npm install image-encode](https://nodei.co/npm/image-encode.png?mini=true)](https://npmjs.org/package/image-encode/)\n\n```js\nlet encode = require('image-encode')\n\n// create a file with chess pattern\nfs.writeFileSync(\n\t'out.png',\n\tBuffer.from(encode([0,0,0,255, 255,255,255,255, 255,255,255,255, 0,0,0,255], [2, 2], 'png'))\n)\n```\n\n## API\n\n### `let data = encode(pixels, shape?, format|options?)`\n\nTakes input `pixels` Array/TypedArray/ArrayBuffer/Buffer/ImageData, returns an ArrayBuffer with encoded `data` in target `format`, one of `png`, `gif`, `tif`, `bmp`, `jpg`.\n\n`options` can provide:\n\n* `format` or `type`, if not specified as a separate argument.\n* `shape` or `width`/`height`, if not defined by `pixels` or as a separate argument.\n* `quality` for JPG encoder.\n* `colors` for palette size in GIF encoder.\n* any other meta fields for encoders.\n\n## See also\n\n* [squoosh.app](https://github.com/GoogleChromeLabs/squoosh) − best in class image compressing app.\n* [image-decode](https://ghub.io/image-decode) − decode image data from a format.\n* [image-equal](https://ghub.io/image-equal) − image data comparing tool.\n* [image-pixels](https://ghub.io/image-pixels) − load or save pixel data from/to any source.\n* [image-save](https://ghub.io/image-save) − save image pixels data to a target.\n* [image-type](https://ghub.io/image-type) − detect input image data type.\n\n\n## Footer\n\n© 2018 Dmitry Yv. MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fimage-encode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdy%2Fimage-encode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fimage-encode/lists"}