R语言imgpalr包,从图像照片创建色卡
R语言 从照片创建色卡
# Sat Mar 20 15:10:52 2021 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.4 for window 10
# cgh163email@163.com
# 个人笔记不负责任,拎了个梨🍐
.rs.restartR()
require(imgpalr)
rm(list = ls());gc()
# 图像读取:
x <- paste0(system.file(package = "imgpalr"), "/blue-yellow.",
c("jpg", "png", "bmp", "gif"))
x
str(image_load(x[1]))
if(require(png)) str(image_load(x[2]))
if(require(bmp)) str(image_load(x[3]))
if(require(magick)) str(image_load(x[4]))
# Sat Mar 20 15:19:12 2021 --
set.seed(1)
x <- system.file("blue-yellow.jpg", package = "imgpalr")
# Focus on bright, saturated colors for divergent palette:
image_pal(x, n = 11, type = "div",
saturation = c(0.75, 1), brightness = c(0.75, 1), plot = TRUE)
image_pal(x, n = 15, type = "seq", k = 2, saturation = c(0.5, 1),
brightness = c(0.25, 1), seq_by = "hsv")
# Sat Mar 20 15:20:33 2021 --end