{"id":15942987,"url":"https://github.com/magicdawn/node-mozjpeg","last_synced_at":"2025-10-19T04:31:00.496Z","repository":{"id":57143562,"uuid":"264286671","full_name":"magicdawn/node-mozjpeg","owner":"magicdawn","description":"mozjpeg node binding","archived":false,"fork":false,"pushed_at":"2023-12-18T17:45:55.000Z","size":10717,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T08:11:14.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/magicdawn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-15T19:59:35.000Z","updated_at":"2024-03-08T14:19:43.000Z","dependencies_parsed_at":"2023-12-18T19:10:18.958Z","dependency_job_id":"a7382993-ec9b-454b-8e74-6880d90faa38","html_url":"https://github.com/magicdawn/node-mozjpeg","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fnode-mozjpeg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fnode-mozjpeg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fnode-mozjpeg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fnode-mozjpeg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicdawn","download_url":"https://codeload.github.com/magicdawn/node-mozjpeg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237068384,"owners_count":19250057,"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-07T08:01:48.375Z","updated_at":"2025-10-19T04:31:00.219Z","avatar_url":"https://github.com/magicdawn.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-mozjpeg\n\n\u003e mozjpeg node binding\n\n[![Build Status](https://img.shields.io/travis/magicdawn/node-mozjpeg.svg?style=flat-square)](https://travis-ci.org/magicdawn/node-mozjpeg)\n[![Coverage Status](https://img.shields.io/codecov/c/github/magicdawn/node-mozjpeg.svg?style=flat-square)](https://codecov.io/gh/magicdawn/node-mozjpeg)\n[![npm version](https://img.shields.io/npm/v/node-mozjpeg.svg?style=flat-square)](https://www.npmjs.com/package/node-mozjpeg)\n[![npm downloads](https://img.shields.io/npm/dm/node-mozjpeg.svg?style=flat-square)](https://www.npmjs.com/package/node-mozjpeg)\n[![npm license](https://img.shields.io/npm/l/node-mozjpeg.svg?style=flat-square)](http://magicdawn.mit-license.org)\n\n## Features\n\n- [x] for a 10MB jpeg file, 2x fast than squoosh or @saschazar/wasm-mozjpeg wasm version.\n- [x] None blocking mozjpeg compress. (u should wrap wasm version it in a WebWorker or node.js Worker)\n\n## Install\n\n```sh\n$ npm i -S node-mozjpeg\n```\n\n## API\n\n```js\nconst mozjpeg = require('node-mozjpeg')\n```\n\n### types\n\n```ts\nexport const version: string\n\nexport enum ColorSpace {\n  GRAYSCALE = 1,\n  RGB,\n  YCbCr,\n}\n\nexport interface EncodeOptions {\n  quality: number\n  baseline: boolean\n  arithmetic: boolean\n  progressive: boolean\n  optimize_coding: boolean\n  smoothing: number\n  color_space: ColorSpace\n  quant_table: number\n  trellis_multipass: boolean\n  trellis_opt_zero: boolean\n  trellis_opt_table: boolean\n  trellis_loops: number\n  auto_subsample: boolean\n  chroma_subsample: number\n  separate_chroma_quality: boolean\n  chroma_quality: number\n}\n```\n\n### encodeSync\n\nthis will **block** the EventLoop, **do not** use in production\n\n```ts\nexport function encodeSync(\n  input: Buffer,\n  width: number,\n  height: number,\n  options?: Partial\u003cEncodeOptions\u003e\n): Buffer\n```\n\n### encode\n\nsame as `encodeSync` except it's using libuv to encode and return Promise\n\n```ts\nexport function encode(\n  input: Buffer,\n  width: number,\n  height: number,\n  options?: Partial\u003cEncodeOptions\u003e\n): Promise\u003cBuffer\u003e\n```\n\n### defaultOptions\n\n```js\nconst defaultOptions = {\n  quality: 75,\n  baseline: false,\n  arithmetic: false,\n  progressive: true,\n  optimize_coding: true,\n  smoothing: 0,\n  color_space: ColorSpace.YCbCr,\n  quant_table: 3,\n  trellis_multipass: false,\n  trellis_opt_zero: false,\n  trellis_opt_table: false,\n  trellis_loops: 1,\n  auto_subsample: true,\n  chroma_subsample: 2,\n  separate_chroma_quality: false,\n  chroma_quality: 75,\n}\n```\n\n## Changelog\n\n[CHANGELOG.md](CHANGELOG.md)\n\n## License\n\nthe MIT License [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Fnode-mozjpeg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicdawn%2Fnode-mozjpeg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Fnode-mozjpeg/lists"}