{"id":23050823,"url":"https://github.com/geta/imagesharp.processing.autocrop","last_synced_at":"2025-08-15T03:31:37.782Z","repository":{"id":45943358,"uuid":"367196570","full_name":"Geta/ImageSharp.Processing.AutoCrop","owner":"Geta","description":"Auto cropping for ImageSharp","archived":false,"fork":false,"pushed_at":"2022-10-10T15:20:06.000Z","size":2639,"stargazers_count":9,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-19T01:00:59.461Z","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/Geta.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}},"created_at":"2021-05-13T23:15:12.000Z","updated_at":"2023-06-26T18:37:33.000Z","dependencies_parsed_at":"2023-01-19T17:45:28.193Z","dependency_job_id":null,"html_url":"https://github.com/Geta/ImageSharp.Processing.AutoCrop","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geta%2FImageSharp.Processing.AutoCrop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geta%2FImageSharp.Processing.AutoCrop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geta%2FImageSharp.Processing.AutoCrop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geta%2FImageSharp.Processing.AutoCrop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Geta","download_url":"https://codeload.github.com/Geta/ImageSharp.Processing.AutoCrop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229890100,"owners_count":18140042,"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-15T23:38:10.549Z","updated_at":"2024-12-15T23:38:11.219Z","avatar_url":"https://github.com/Geta.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImageSharp.Processing.AutoCrop\n\n## Description\n\nAutomatic cropping for images with a flat background.\nWorks with SixLabors.ImageSharp 2.0.0 and above.\n\nUses a relative luminance tolerance to determine which area to crop.\n\n## Features\n\n- Crops images with a flat background\n- Configurable x and y padding\n- Configurable treshold\n\n## How to get started?\n\n### ImageSharp.Web integration\n\nRequires SixLabors.ImageSharp 2.0.0 or above\n\n- `install-package ImageSharp.Web.AutoCrop`\n\nThe namespace `ImageSharp.Web.AutoCrop.Extensions` contains some useful extensions to `SixLabors.ImageSharp.Web.DependencyInjection.IImageSharpBuilder`\n\n#### In Startup.cs\n\nMake sure to call the extension `AddAutoCropProcessor` when adding ImageSharp to services, that's all.\n\n```\npublic void ConfigureServices(IServiceCollection services)\n{\n    services.AddImageSharp()\n            .AddAutoCropProcessor();\n    ...\n}\n\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n{\n    // Configure ImageSharp.Web\n    app.UseImageSharp();\n    ...\n}\n```\n\nCheck out the [demo](docs/demo.md) for some examples.\nCheck out the [demo project](src/ImageSharp.Web.AutoCrop.Demo) for the full source.\n\n### Plain AutoCrop\n\nRequires SixLabors.ImageSharp 2.0.0 or above\n\n- `install-package ImageSharp.Processing.AutoCrop`\n\nThe namespace `ImageSharp.Processing.AutoCrop.Extensions` contains some useful extensions to `SixLabors.ImageSharp.Processing.IImageProcessingContext`\n\n```\nusing var image = Image.Load(\"image.png\");\n\nimage.Mutate(ctx =\u003e ctx.AutoCrop());\n```\n\nCheck the different overloads for some options.\n\n## Details\n\nThe underlying `AutoCropProcessor` that will handle the actual cropping takes some parameters.\n\n| Parameter       | Description                                                                                      | Default value |\n| --------------- | ------------------------------------------------------------------------------------------------ | ------------- |\n| PadX            | How much horizontal whitespace in percent (0-100) to apply outside the crop                      | 0             |\n| PadY            | How much vertical whitespace in percent (0-100) to apply outside the crop                        | 0             |\n| PadMode         | Determines if padding should be allowed to expand outside the original image (Expand or Contain) | Expand        |\n| ColorThreshold  | Color divergence to tolerate from analyzed border color (0-255)                                  | 35            |\n| BucketThreshold | How many percent of the border that has to belong to the most present color bucket (0.0f-1.0f)   | 0.945f        |\n\n## How it works\n\n![How it works](docs/how-it-works.png)\n\n## Package maintainer\n\nhttps://github.com/svenrog\n\n## Changelog\n\n[Changelog](CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeta%2Fimagesharp.processing.autocrop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeta%2Fimagesharp.processing.autocrop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeta%2Fimagesharp.processing.autocrop/lists"}