#' @title Extract pixel color using specified point geometry
#' @description Extracts hex color of the pixel at the specified location
#' @param img magick image
#' @param geometry point geomentry (generated by `magick::geometry_point()`) in the format (`+x+y`)
#' @return hex value of the color
#' @examples
#' \dontrun{
#' if(interactive()){
#' frink <- image_read("https://jeroen.github.io/images/frink.png")
#' image_getpixel(frink, geometry_point(100,100))
#' }
#' }
#' @seealso
#' \code{\link[magick]{editing}},\code{\link[magick]{transform}}
#' @rdname image_getpixel
#' @export
#' @importFrom magick image_raster image_crop
image_getpixel <- function(img, geometry){
magick::image_raster(magick::image_crop(img, paste0("1x1",geometry)))$col
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.