Description Usage Arguments Value Examples
get_colors
extract colors from Windows BMP, JPEG, PNG, TIFF, and SVG format images.
1 2 |
img |
path or url to image. |
exclude_col |
vector of colors to be excluded from the analysis. The built-in colors (see |
exclude_rad |
numeric vector with blurring of the colors to be excluded. Corresponds to a maximum spherical distance
in the RGB color space (all dimensions range from 0 to 255). If |
top_n |
display the most frequent colors. |
min_share |
display the colors with a minimum share of all pixels (0-1). |
get_stats |
if |
If get_stats
is set to FALSE
a character vector
containing the hex color codes is returned. Otherwise,
a data.frame
(tibble::tibble
) is returned with the following columns:
col_hex
hex color code.
col_freq
absolute frequency of the color.
col_share
relative frequency of the color.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Extract all colors
pic1 <- system.file("extdata", "pic1.png", package = "colorfindr")
get_colors(pic1)
# Extract three most frequent colors
pic2 <- system.file("extdata", "pic2.tif", package = "colorfindr")
get_colors(pic2, top_n = 3)
# Extract colors that fill over 20% of the area
pic3 <- system.file("extdata", "pic3.jpg", package = "colorfindr")
get_colors(pic3, min_share = 0.2)
# Extract all colors except white
pic4 <- system.file("extdata", "pic4.bmp", package = "colorfindr")
get_colors(pic4, exclude_col = "white")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.