{"id":13400556,"url":"https://github.com/muesli/smartcrop","last_synced_at":"2025-05-14T02:08:24.342Z","repository":{"id":15797722,"uuid":"18537125","full_name":"muesli/smartcrop","owner":"muesli","description":"smartcrop finds good image crops for arbitrary crop sizes","archived":false,"fork":false,"pushed_at":"2023-07-06T12:16:16.000Z","size":22149,"stargazers_count":1830,"open_issues_count":9,"forks_count":112,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-04-10T18:31:28.525Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Go","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/muesli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"muesli"}},"created_at":"2014-04-07T22:40:03.000Z","updated_at":"2025-03-28T13:37:07.000Z","dependencies_parsed_at":"2024-01-08T15:34:39.901Z","dependency_job_id":null,"html_url":"https://github.com/muesli/smartcrop","commit_stats":{"total_commits":154,"total_committers":11,"mean_commits":14.0,"dds":0.4415584415584416,"last_synced_commit":"f1935b108c21d44756141bfebf302dfd7b03fdbe"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fsmartcrop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fsmartcrop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fsmartcrop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muesli%2Fsmartcrop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muesli","download_url":"https://codeload.github.com/muesli/smartcrop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254053167,"owners_count":22006717,"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":["hacktoberfest"],"created_at":"2024-07-30T19:00:53.283Z","updated_at":"2025-05-14T02:08:19.327Z","avatar_url":"https://github.com/muesli.png","language":"Go","funding_links":["https://github.com/sponsors/muesli"],"categories":["Go","开源类库","Images","Open source library","圖象","图片","图像","Images 图像处理","\u003cspan id=\"图片-images\"\u003e图片 Images\u003c/span\u003e","Relational Databases"],"sub_categories":["图形处理","Search and Analytic Databases","Advanced Console UIs","Graphics Processing","高級控制台界面","检索及分析资料库","高级控制台界面","交流","SQL 查询语句构建库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"smartcrop\n=========\n\n[![Latest Release](https://img.shields.io/github/release/muesli/smartcrop.svg)](https://github.com/muesli/smartcrop/releases)\n[![Build Status](https://github.com/muesli/smartcrop/workflows/build/badge.svg)](https://github.com/muesli/smartcrop/actions)\n[![Coverage Status](https://coveralls.io/repos/github/muesli/smartcrop/badge.svg?branch=master)](https://coveralls.io/github/muesli/smartcrop?branch=master)\n[![Go ReportCard](https://goreportcard.com/badge/muesli/smartcrop)](https://goreportcard.com/report/muesli/smartcrop)\n[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/muesli/smartcrop)\n\nsmartcrop finds good image crops for arbitrary sizes. It is a pure Go implementation, based on Jonas Wagner's [smartcrop.js](https://github.com/jwagner/smartcrop.js)\n\n![Example](./examples/gopher.jpg)\nImage: [https://www.flickr.com/photos/usfwspacific/8182486789](https://www.flickr.com/photos/usfwspacific/8182486789) by Washington Dept of Fish and Wildlife, originally licensed under [CC-BY-2.0](https://creativecommons.org/licenses/by/2.0/) when the image was imported back in September 2014\n\n![Example](./examples/goodtimes.jpg)\nImage: [https://www.flickr.com/photos/endogamia/5682480447](https://www.flickr.com/photos/endogamia/5682480447) by Leon F. Cabeiro (N. Feans), licensed under [CC-BY-2.0](https://creativecommons.org/licenses/by/2.0/)\n\n## Installation\n\nMake sure you have a working Go environment (Go 1.12 or higher is required).\nSee the [install instructions](https://golang.org/doc/install.html).\n\nTo install smartcrop, simply run:\n\n    go get github.com/muesli/smartcrop\n\nTo compile it from source:\n\n    git clone https://github.com/muesli/smartcrop.git\n    cd smartcrop\n    go build\n\n## Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"image\"\n\t_ \"image/png\"\n\t\"os\"\n\n\t\"github.com/muesli/smartcrop\"\n\t\"github.com/muesli/smartcrop/nfnt\"\n)\n\nfunc main() {\n\tf, _ := os.Open(\"image.png\")\n\timg, _, _ := image.Decode(f)\n\n\tanalyzer := smartcrop.NewAnalyzer(nfnt.NewDefaultResizer())\n\ttopCrop, _ := analyzer.FindBestCrop(img, 250, 250)\n\n\t// The crop will have the requested aspect ratio, but you need to copy/scale it yourself\n\tfmt.Printf(\"Top crop: %+v\\n\", topCrop)\n\n\ttype SubImager interface {\n\t\tSubImage(r image.Rectangle) image.Image\n\t}\n\tcroppedimg := img.(SubImager).SubImage(topCrop)\n\t// ...\n}\n```\n\nAlso see the test cases in smartcrop_test.go and cli application in cmd/smartcrop/ for further working examples.\n\n## Simple CLI application\n\n    go install github.com/muesli/smartcrop/cmd/smartcrop\n\n    Usage of smartcrop:\n      -height int\n            crop height\n      -input string\n            input filename\n      -output string\n            output filename\n      -quality int\n            jpeg quality (default 85)\n      -resize\n            resize after cropping (default true)\n      -width int\n            crop width\n\nExample:\n    smartcrop -input examples/gopher.jpg -output gopher_cropped.jpg -width 300 -height 150\n\n## Sample Data\n\nYou can find a bunch of test images for the algorithm [here](https://github.com/muesli/smartcrop-samples).\n\n## Feedback\n\nGot some feedback or suggestions? Please open an issue or drop me a note!\n\n* [Twitter](https://twitter.com/mueslix)\n* [The Fediverse](https://mastodon.social/@fribbledom)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuesli%2Fsmartcrop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuesli%2Fsmartcrop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuesli%2Fsmartcrop/lists"}