{"id":17664455,"url":"https://github.com/tilfin/sharp-mozjpeg-image-processor","last_synced_at":"2025-03-30T12:16:52.919Z","repository":{"id":40416569,"uuid":"238607006","full_name":"tilfin/sharp-mozjpeg-image-processor","owner":"tilfin","description":"Scaled and optimized JPEG image file generater powered by sharp and mozjpeg","archived":false,"fork":false,"pushed_at":"2025-01-17T11:41:34.000Z","size":470,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T14:12:33.741Z","etag":null,"topics":["image-processing","mozjpeg","sharp"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tilfin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-06T04:25:28.000Z","updated_at":"2025-01-17T11:40:54.000Z","dependencies_parsed_at":"2023-02-12T02:31:07.459Z","dependency_job_id":null,"html_url":"https://github.com/tilfin/sharp-mozjpeg-image-processor","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/tilfin%2Fsharp-mozjpeg-image-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fsharp-mozjpeg-image-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fsharp-mozjpeg-image-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fsharp-mozjpeg-image-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tilfin","download_url":"https://codeload.github.com/tilfin/sharp-mozjpeg-image-processor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314150,"owners_count":20757463,"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":["image-processing","mozjpeg","sharp"],"created_at":"2024-10-23T20:05:28.834Z","updated_at":"2025-03-30T12:16:52.899Z","avatar_url":"https://github.com/tilfin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sharp-mozjpeg-image-processor\n\n[![npm version](https://img.shields.io/npm/v/sharp-mozjpeg-image-processor.svg)](https://npmjs.org/package/sharp-mozjpeg-image-processor)\n[![Node](https://img.shields.io/node/v/sharp-mozjpeg-image-processor.svg)]()\n[![Build \u0026 Test](https://github.com/tilfin/sharp-mozjpeg-image-processor/actions/workflows/ci.yml/badge.svg)](https://github.com/tilfin/sharp-mozjpeg-image-processor/actions/workflows/ci.yml)\n\nGenerates scaled (by sharp) and optimized (by mozjpeg) image files from a source image file\n\n## Install\n\n```\n$ npm i -save sharp-mozjpeg-image-processor\n```\n\n## How to use\n\n```js\nconst fs = require('fs')\nconst { ImageProcessor } = require('sharp-mozjpeg-image-processor')\n\nconst processor = new ImageProcessor()\n\nconst srcStream = fs.createReadStream('./source.jpg')\nconst imgInfos = [\n  {\n    kind: 'large',\n    width: 1200,\n    height: 1200,\n  },\n  {\n    kind: 'small',\n    width: 800,\n    height: 800,\n  },\n  {\n    kind: 'thumb',\n    width: 400,\n    height: 400,\n    crop: true, // cover for example thumbnail\n  }\n]\nconst quality = 70 // default 80 for jpeg image quality\n\nprocessor.execute(srcStream, imgInfos, quality)\n.then(outImgInfos =\u003e {\n  for (let outImgInfo of outImgInfos) {\n    console.log(outImgInfo)\n  }\n})\n```\n\n```js\n{\n  kind: 'large',\n  format: 'jpeg',\n  width: 900,\n  height: 1200,\n  filePath: '/tmp/work897439499/optimized/large.jpg'\n}\n{\n  kind: 'small',\n  format: 'jpeg',\n  width: 600,\n  height: 800,\n  filePath: '/tmp/work897439499/optimized/small.jpg'\n}\n{\n  kind: 'thumb',\n  format: 'jpeg',\n  width: 400,\n  height: 400,\n  filePath: '/tmp/work897439499/optimized/thumb.jpg'\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftilfin%2Fsharp-mozjpeg-image-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftilfin%2Fsharp-mozjpeg-image-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftilfin%2Fsharp-mozjpeg-image-processor/lists"}