{"id":22800013,"url":"https://github.com/dadi/smartcrop-sharp","last_synced_at":"2025-06-17T03:03:06.576Z","repository":{"id":151392720,"uuid":"271734469","full_name":"dadi/smartcrop-sharp","owner":"dadi","description":null,"archived":false,"fork":false,"pushed_at":"2020-06-12T07:20:52.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T19:17:38.589Z","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/dadi.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-12T07:17:05.000Z","updated_at":"2020-06-12T07:21:29.000Z","dependencies_parsed_at":"2023-07-16T11:31:27.613Z","dependency_job_id":null,"html_url":"https://github.com/dadi/smartcrop-sharp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dadi/smartcrop-sharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fsmartcrop-sharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fsmartcrop-sharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fsmartcrop-sharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fsmartcrop-sharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dadi","download_url":"https://codeload.github.com/dadi/smartcrop-sharp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fsmartcrop-sharp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260281568,"owners_count":22985626,"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-12-12T07:10:48.038Z","updated_at":"2025-06-17T03:03:06.514Z","avatar_url":"https://github.com/dadi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smartcrop-sharp\n\n[![Build Status](https://travis-ci.org/jwagner/smartcrop-sharp.svg?branch=master)](https://travis-ci.org/jwagner/smartcrop-sharp)\n\nThis is an adapter module for using [smartcrop.js](https://github.com/jwagner/smartcrop.js)\nwith node.js using [sharp](https://github.com/lovell/sharp) for image decoding.\n\n## Installation\n```\nnpm install --save smartcrop-sharp\n```\n\n## API\n\n## crop(image, options)\n\n**Image:** string (path to file) or buffer\n\n**Options:** options object to be passed to smartcrop\n\n**returns:** A promise for a cropResult\n\n## Example\n\n```javascript\nvar request = require('request');\nvar sharp = require('sharp');\nvar smartcrop = require('smartcrop-sharp');\n\nfunction applySmartCrop(src, dest, width, height) {\n  request(src, {encoding: null}, function process(error, response, body) {\n    if (error) return console.error(error);\n    smartcrop.crop(body, {width: width, height: height}).then(function(result) {\n      var crop = result.topCrop;\n      sharp(body)\n        .extract({width: crop.width, height: crop.height, left: crop.x, top: crop.y})\n        .resize(width, height)\n        .toFile(dest);\n    });\n  });\n}\n\nvar src = 'https://raw.githubusercontent.com/jwagner/smartcrop-gm/master/test/flower.jpg';\napplySmartCrop(src, 'flower-square.jpg', 128, 128);\n\n\n```\n\n## Face Detection Example\n  Check out [smartcrop-cli](https://github.com/jwagner/smartcrop-cli/) for a more advanced [example](https://github.com/jwagner/smartcrop-cli/blob/master/smartcrop-cli.js#L100) of how to use smartcrop from node  including face detection with opencv.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fsmartcrop-sharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdadi%2Fsmartcrop-sharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fsmartcrop-sharp/lists"}