{"id":13564314,"url":"https://github.com/oliamb/cutter","last_synced_at":"2026-04-06T00:05:06.412Z","repository":{"id":14576550,"uuid":"17292818","full_name":"oliamb/cutter","owner":"oliamb","description":"Crop images in Golang","archived":false,"fork":false,"pushed_at":"2021-06-28T12:24:58.000Z","size":3836,"stargazers_count":200,"open_issues_count":3,"forks_count":28,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-02T09:42:04.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://godoc.org/github.com/oliamb/cutter","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/oliamb.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":"2014-02-28T16:50:17.000Z","updated_at":"2024-09-30T14:05:39.000Z","dependencies_parsed_at":"2022-09-26T17:41:15.461Z","dependency_job_id":null,"html_url":"https://github.com/oliamb/cutter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliamb%2Fcutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliamb%2Fcutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliamb%2Fcutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliamb%2Fcutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliamb","download_url":"https://codeload.github.com/oliamb/cutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082906,"owners_count":20880740,"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-08-01T13:01:29.580Z","updated_at":"2025-12-16T23:06:39.790Z","avatar_url":"https://github.com/oliamb.png","language":"Go","funding_links":[],"categories":["Go","Misc"],"sub_categories":[],"readme":"Cutter\n======\n\nA Go library to crop images.\n\n[![Build Status](https://travis-ci.org/oliamb/cutter.png?branch=master)](https://travis-ci.org/oliamb/cutter)\n[![GoDoc](https://godoc.org/github.com/oliamb/cutter?status.png)](https://godoc.org/github.com/oliamb/cutter)\n\nCutter was initially developped to be able\nto crop image resized using github.com/nfnt/resize.\n\nUsage\n-----\n\nRead the doc on https://godoc.org/github.com/oliamb/cutter\n\nImport package with\n\n```go\nimport \"github.com/oliamb/cutter\"\n```\n\nPackage cutter provides a function to crop image.\n\nBy default, the original image will be cropped at the\ngiven size from the top left corner.\n\n```go\ncroppedImg, err := cutter.Crop(img, cutter.Config{\n  Width:  250,\n  Height: 500,\n})\n```\n\nMost of the time, the cropped image will share some memory\nwith the original, so it should be used read only. You must\nask explicitely for a copy if nedded.\n\n```go\ncroppedImg, err := cutter.Crop(img, cutter.Config{\n  Width:  250,\n  Height: 500,\n  Options: cutter.Copy,\n})\n```\n\nIt is possible to specify the top left position:\n\n```go\ncroppedImg, err := cutter.Crop(img, cutter.Config{\n  Width:  250,\n  Height: 500,\n  Anchor: image.Point{100, 100},\n  Mode:   cutter.TopLeft, // optional, default value\n})\n```\n\nThe Anchor property can represents the center of the cropped image\ninstead of the top left corner:\n\n```go\ncroppedImg, err := cutter.Crop(img, cutter.Config{\n  Width: 250,\n  Height: 500,\n  Mode: cutter.Centered,\n})\n```\n\nThe default crop use the specified dimension, but it is possible\nto use Width and Heigth as a ratio instead. In this case,\nthe resulting image will be as big as possible to fit the asked ratio\nfrom the anchor position.\n\n```go\ncroppedImg, err := cutter.Crop(baseImage, cutter.Config{\n  Width: 4,\n  Height: 3,\n  Mode: cutter.Centered,\n  Options: cutter.Ratio\u0026cutter.Copy, // Copy is useless here\n})\n```\n\nAbout resize\n------------\nThis lib only manage crop and won't resize image, but it works great in combination with [github.com/nfnt/resize](https://github.com/nfnt/resize)\n\nContributing\n------------\nI'd love to see your contributions to Cutter. If you'd like to hack on it: \n\n- fork the project,\n- hack on it,\n- ensure tests pass,\n- make a pull request\n\nIf you plan to modify the API, let's disscuss it first.\n\nLicensing\n---------\nMIT License, Please see the file called LICENSE.\n\nCredits\n-------\nTest Picture: Gopher picture from Heidi Schuyt, http://www.flickr.com/photos/hschuyt/7674222278/,\n© copyright Creative Commons(http://creativecommons.org/licenses/by-nc-sa/2.0/)\n\nThanks to Urturn(http://www.urturn.com) for the time allocated to develop the library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliamb%2Fcutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliamb%2Fcutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliamb%2Fcutter/lists"}