{"id":13788829,"url":"https://github.com/zumbov2/colorfindr","last_synced_at":"2025-04-13T06:36:47.922Z","repository":{"id":45661941,"uuid":"149522150","full_name":"zumbov2/colorfindr","owner":"zumbov2","description":"Extracts colors from various image types, plots treemaps and 3D scatterplots of color compositions, create color palettes.","archived":false,"fork":false,"pushed_at":"2020-09-25T19:02:10.000Z","size":60367,"stargazers_count":141,"open_issues_count":0,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T23:05:44.276Z","etag":null,"topics":["3d-scatter-plot","colors","plotly","rstats","treemap"],"latest_commit_sha":null,"homepage":"","language":"R","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/zumbov2.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}},"created_at":"2018-09-19T23:05:55.000Z","updated_at":"2025-03-04T14:12:58.000Z","dependencies_parsed_at":"2022-09-02T08:15:33.869Z","dependency_job_id":null,"html_url":"https://github.com/zumbov2/colorfindr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fcolorfindr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fcolorfindr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fcolorfindr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fcolorfindr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zumbov2","download_url":"https://codeload.github.com/zumbov2/colorfindr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675303,"owners_count":21143763,"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":["3d-scatter-plot","colors","plotly","rstats","treemap"],"created_at":"2024-08-03T21:00:54.323Z","updated_at":"2025-04-13T06:36:47.895Z","avatar_url":"https://github.com/zumbov2.png","language":"R","funding_links":[],"categories":["R","ggplot"],"sub_categories":["Palettes 🎨"],"readme":"[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/colorfindr)](https://cran.r-project.org/package=colorfindr)\n[![Build Status](https://travis-ci.org/zumbov2/colorfindr.svg?branch=master)](https://travis-ci.org/zumbov2/colorfindr)\n[![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)\n[![cranlogs](https://cranlogs.r-pkg.org/badges/grand-total/colorfindr)](http://cran.rstudio.com/web/packages/colorfindr/index.html)\n\n# `colorfindr`\nThis R package allows you to **extract colors** from various image types (currently JPEG, PNG, TIFF, SVG, BMP). Either a tailored **report** (directly with the main function `get_colors`), a **treemap** (`plot_colors`) or a **3D scatterplot** (`plot_colors_3d`) with the image color composition can be returned. Version 0.1.4 provides several methods for creating discrete **color palettes**.\n\n## Installation\nVersion 0.1.4 is on CRAN and can be installed as follows:\n```r\ninstall.packages(\"colorfindr\")\n```\nInstall from GitHub for a regularly updated version (latest: 0.1.4):\n```r\ninstall.packages(\"devtools\")\ndevtools::install_github(\"zumbov2/colorfindr\")\n```\n# Treemap examples\n## Color composition of the South African flag\n\u003cimg src=\"https://raw.githubusercontent.com/zumbov2/colorfindr/master/img/rsa1.png\" width=\"800\"\u003e\n\n### Code\n```r\n# Load packages\npacman::p_load(colorfindr, dplyr)\n\n# Plot\nget_colors(\n  img = \"https://upload.wikimedia.org/wikipedia/commons/a/af/Flag_of_South_Africa.svg\",\n  min_share = 0.05\n) %\u003e%\n  plot_colors(sort = \"size\")\n```\n\n## Flags of Swiss Cantons\n\u003cimg src=\"https://raw.githubusercontent.com/zumbov2/colorfindr/master/img/k1_new.png\" width=\"800\"\u003e\n\n### Code\n```r\n# Load packages\npacman::p_load(colorfindr, dplyr)\n\n# Images\nimg \u003c- c(\n  \"https://upload.wikimedia.org/wikipedia/commons/b/b5/Wappen_Aargau_matt.svg\",\n  \"https://upload.wikimedia.org/wikipedia/commons/0/0e/Wappen_Glarus_matt.svg\",\n  \"https://upload.wikimedia.org/wikipedia/commons/4/47/Wappen_Bern_matt.svg\",\n  \"https://upload.wikimedia.org/wikipedia/commons/d/d1/Wappen_Neuenburg_matt.svg\"\n)\n\n# Plot\nfor (i in 1:length(img)) get_colors(img[i], top_n = 4) %\u003e% plot_colors(sort = \"size\")\n```\n\n# 3D Scatterplot examples\nThis part of the package was inspired by the wonderful plots of [alfieish](https://github.com/alfieish). They caused a sensation on [Reddit](https://www.reddit.com/r/dataisbeautiful/comments/7584no/3d_rgb_scatterplots_of_colours_used_in_famous/) in autumn 2017. The plots are created with [Plotly](https://plot.ly) and are accordingly interactive.\n\n## Color composition of Edvard Munch's *The Scream*\n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/the_scream_color_composition.gif\" width=\"500\"\u003e  \nThe original can be found under: https://plot.ly/~zumbov/14.embed.\n\n### Code\n```r\n# Load packages\npacman::p_load(colorfindr, dplyr)\n\n# Plot (5000 randomly selected pixels)\nget_colors(\"https://upload.wikimedia.org/wikipedia/commons/f/f4/The_Scream.jpg\") %\u003e% \n  plot_colors_3d(sample_size = 5000, marker_size = 2.5, color_space = \"RGB\")\n```\n\n## Color composition of Salvador Dalí's *The Persistence of Memory*\n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/the_persistence_of_memory_color_composition.gif\" width=\"500\"\u003e  \nThe original can be found under: https://plot.ly/~zumbov/20.embed.\n\n### Code\n```r\n# Load packages\npacman::p_load(colorfindr, dplyr)\n\n# Plot (5000 randomly selected pixels)\nget_colors(\"http://wisetoast.com/wp-content/uploads/2015/10/The-Persistence-of-Memory-salvador-deli-painting.jpg\") %\u003e%\n  plot_colors_3d(sample_size = 5000, marker_size = 2.5, color_space = \"RGB\")\n```\nRead more [here](https://plot.ly/r/getting-started/) on how to publish your graphs to Plotly.\n  \n## Other masterpieces\nDa Vinci's [Mona Lisa](https://en.wikipedia.org/wiki/Mona_Lisa) -\u003e [Color composition](https://plot.ly/~zumbov/10.embed)  \nVermeer's [Girl with a Pearl Earring](https://en.wikipedia.org/wiki/Girl_with_a_Pearl_Earring) -\u003e [Color composition](https://plot.ly/~zumbov/12.embed)  \nKlimt's [The Kiss](https://en.wikipedia.org/wiki/The_Kiss_(Klimt)) -\u003e [Color composition](https://plot.ly/~zumbov/16.embed)  \nVan Gogh's [The Starry Night](https://en.wikipedia.org/wiki/The_Starry_Night) -\u003e [Color composition](https://plot.ly/~zumbov/18.embed)\n\n## Different color spaces\nFrom version 0.1.2 on it is possible to display the point clouds in different color spaces: Besides ...\n\n[RGB](https://en.wikipedia.org/wiki/RGB_color_space)  \n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/rgb.gif\" width=\"300\"\u003e  \n\n[HSV](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, value) and ...  \n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/hsv.gif\" width=\"300\"\u003e  \n\n[HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness) ...  \n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/hsl.gif\" width=\"300\"\u003e  \nare available.\n\n### Code\n```r\n# Load packages\npacman::p_load(dplyr, colorfindr)\n\n# Get colors\ncol \u003c- get_colors(\"http://joco.name/wp-content/uploads/2014/03/rgb_256_1.png\")\n\n# Plot to alternative color spaces\nplot_colors_3d(col, color_space = \"RGB\")\nplot_colors_3d(col, color_space = \"HSV\")\nplot_colors_3d(col, color_space = \"HSL\")\n```\n\n# Creating color palettes\nVersion 0.1.4 provides various methods for creating color palettes with a distinct number of colors. The default method performs a [k-means](https://en.wikipedia.org/wiki/K-means_clustering) clustering on the pixels in the RGB color space (`clust_method = \"kmeans\"`). Alternatively, the pixel clusters can be created with a version of the [median cut](https://en.wikipedia.org/wiki/Median_cut) algorithm (`clust_method = \"median_cut\"`). The user can also choose whether the most common RGB combination per cluster is extracted (default: `extract_method = \"hex_freq\"`) or whether new RGB combinations are created for each cluster, either based on the mean (`extract_method = \"mean\"`), median (`extract_method = \"median\"`) or mode (`extract_method = \"mode\"`) of the RGB dimensions. The default has the advantage that the extracted colors actually appear in the image used. For images with many color nuances, however, the other extraction methods seem to achieve more convincing results. \n\n## Childhood memories I\n\u003cimg src=\"https://www.movieart.ch/bilder_xl/tintin-et-milou-poster-11438_0_xl.jpg\" width=\"300\"\u003e\n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/ts.png\" width=\"300\"\u003e  \n\n### Code\n```r\n# Load packages\npacman::p_load(dplyr, colorfindr)\n\n# Ensure reproducibility\nset.seed(123)\n\n# Get colors and create a palette with n = 5 \nget_colors(\"https://www.movieart.ch/bilder_xl/tintin-et-milou-poster-11438_0_xl.jpg\") %\u003e% \nmake_palette(n = 5)\n```\n\n## Childhood memories II\n\u003cimg src=\"http://www.coverbrowser.com/image/lucky-luke/5-1.jpg\" width=\"300\"\u003e\n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/ll.png\" width=\"300\"\u003e  \n\n### Code\n```r\n# Load packages\npacman::p_load(dplyr, colorfindr)\n\n# Ensure reproducibility\nset.seed(123)\n\n# Get colors and create a palette with n = 5 \nget_colors(\"http://www.coverbrowser.com/image/lucky-luke/5-1.jpg\") %\u003e% \n    make_palette(n = 5)\n```\n\n## Vintage ads from Switzerland I\n\u003cimg src=\"http://www.gallery29.ie/images/posters/1171469398_DSC03889.jpg\" width=\"300\"\u003e\n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/la.png\" width=\"300\"\u003e  \n\n### Code\n```r\n# Load packages\npacman::p_load(dplyr, colorfindr)\n\n# Ensure reproducibility\nset.seed(123)\n\n# Get colors and create a palette with n = 5 \nget_colors(\"http://www.gallery29.ie/images/posters/1171469398_DSC03889.jpg\") %\u003e% \n    make_palette(n = 5)\n```\n\n## Vintage ads from Switzerland II\n\u003cimg src=\"https://www.artifiche.com/cms/upload/posters_extralarge/2850.jpg\" width=\"300\"\u003e\n\u003cimg src=\"https://github.com/zumbov2/colorfindr/blob/master/img/fl.png\" width=\"300\"\u003e  \n\n### Code\n```r\n# Load packages\npacman::p_load(dplyr, colorfindr)\n\n# Ensure reproducibility\nset.seed(123)\n\n# Get colors and create a palette with n = 5 \nget_colors(\"https://www.artifiche.com/cms/upload/posters_extralarge/2850.jpg\") %\u003e% \n    make_palette(n = 5)\n```\n\n**Happy Testing!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumbov2%2Fcolorfindr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzumbov2%2Fcolorfindr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumbov2%2Fcolorfindr/lists"}