imgpal | R Documentation |
Extract unique and most commonly-used unique colors from an image file (requires ImageMagick).
imgpal(path, n = 10L, options = "")
path |
full file path to image |
n |
maximum number of colors to extract, result will be <= |
options |
a (optional) character string of additional options passed
to |
A list of class "imgpal"
with the following elements:
filename |
the image file name |
n_unique |
the calculated number of unique colors |
col |
a vector of colors (does not return transparent or white colors) |
counts |
frequency counts for each |
call |
the call made to |
magick |
the result of |
show_pal
; magick
package
go <- 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'
ip <- imgpal(go)
show_pal(ip, n = 4)
ip <- imgpal(go, options = '-colorize 0,0,50')
show_pal(ip)
## Not run:
## rawr::rawr_palettes
img <- system.file('fig', package = 'rawr')
img <- list.files(img, full.names = TRUE, pattern = 'g$')
op <- par(mfrow = n2mfrow(length(img)))
sapply(img, function(x) show_pal(imgpal(x), fullrange = TRUE))
par(op)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.