{"id":14066699,"url":"https://github.com/doehm/cropcircles","last_synced_at":"2025-10-21T19:42:09.527Z","repository":{"id":59287457,"uuid":"534931392","full_name":"doehm/cropcircles","owner":"doehm","description":"Crops an image to a circle in R","archived":false,"fork":false,"pushed_at":"2023-12-01T07:45:01.000Z","size":6874,"stargazers_count":41,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-31T22:51:32.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"R","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/doehm.png","metadata":{"files":{"readme":"README.Rmd","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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-10T07:57:40.000Z","updated_at":"2025-07-25T16:41:25.000Z","dependencies_parsed_at":"2024-01-18T04:07:59.652Z","dependency_job_id":"5ba59c81-dc15-438d-a270-37dfb7dce339","html_url":"https://github.com/doehm/cropcircles","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"a87469e2d7337409d2dfb39d581b5188f745537f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/doehm/cropcircles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doehm%2Fcropcircles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doehm%2Fcropcircles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doehm%2Fcropcircles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doehm%2Fcropcircles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doehm","download_url":"https://codeload.github.com/doehm/cropcircles/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doehm%2Fcropcircles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280325269,"owners_count":26311417,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-13T07:05:13.339Z","updated_at":"2025-10-21T19:42:09.500Z","avatar_url":"https://github.com/doehm.png","language":"R","funding_links":[],"categories":["R","Icons, patterns and images"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r, echo=FALSE}\nlibrary(cropcircles)\n```\n\n\n\u003cimg src='https://cranlogs.r-pkg.org/badges/cropcircles'/\u003e\u003cimg src='https://cranlogs.r-pkg.org/badges/grand-total/cropcircles'/\u003e\u003cimg src='https://www.r-pkg.org/badges/version/cropcircles'/\u003e\n\n# cropcircles \u003cimg src='dev/images/hex.png' align=\"right\" height=\"240\" /\u003e\n\nCrop an image into a circle with a transparent background.\n\nThe purpose of this package is to provide a simple and straight forward way to circle crop an image, with a transparent background and plot it with `ggimage`, `ggpath`, or include in tables using e.g. `gt`, `reactable`, etc. There are a few ways to do this, but this package intends to make it as simplified as possible.\n\n## Release notes\n\nVersion 0.2.4 has changed the function naming convention to `crop_*`. `circle_crop` and `hex_crop` are still available and work the same way so won't break existing code but will be deprecated at some stage.\n\n## Installation\n\nFrom CRAN\n\n```{r, eval = FALSE}\ninstall.packages(\"cropcircles\")\n```\n\nOr Git\n\n```{r, eval = FALSE}\ndevtools::install_github(\"doehm/cropcircles\")\n```\n\n## Usage\n\nThe main function `crop_circle` takes a vector of image paths, either local or URL links, crops the image and returns the path. The path of the cropped images can be provided or if left blank it will save them to a temp location which is cleared when the session ends.\n\nA border can be added by specifying the size (in pixels) and colour.\n\n```{r, echo=TRUE, eval=TRUE}\n\nlibrary(cropcircles)\nlibrary(magick)\n\nimg_path \u003c- file.path(system.file(package = \"cropcircles\"), \"images\", \"walter-jesse.png\")\n\n# saves to a temporary path\nimg_cropped \u003c- crop_circle(img_path, border_size = 4)\n\n# plot image with magic\n# can be used with ggimage or ggpath\nimage_read(img_cropped)\n\n# other geometries\n\nimage_read(crop_hex(img_path, border_size = 4))\nimage_read(crop_heart(img_path, border_size = 4))\n\n```\n\n\u003c!-- \u003cimg src='dev/images/bb.png' align=\"center\"/\u003e --\u003e\n\nThe function can take an image with any dimensions. It will circle crop the image from the center with a diameter of the smallest dimension.\n\n## Justify\n\nWith rectangular images the subject for focus may not be centered. The `crop_*` functions include a `just` argument which can take values `left`, `right`, `top` and `bottom`. It simply shifts the initial cropping window to the desired side.\n\n```{r}\nlibrary(magick)\n\n# justification example\nimg_path \u003c- file.path(system.file(package = \"cropcircles\"), \"images\", \"walter-jesse.png\")\norig \u003c- image_read(img_path)\n\n# center (default)\ncenter \u003c- image_read(crop_circle(img_path, border_size = 4))\n\n# left\nleft \u003c- image_read(crop_circle(img_path, border_size = 4, just = \"left\"))\n\n# right\nright \u003c- image_read(crop_circle(img_path, border_size = 4, just = \"right\"))\n\nimage_montage(c(orig, center, left, right))\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoehm%2Fcropcircles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoehm%2Fcropcircles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoehm%2Fcropcircles/lists"}