Skip to content

It's a package containing functions that allow you to create your own color palette from an image, using mathematical algorithms

Notifications You must be signed in to change notification settings

musajajorge/makePalette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

makePalette

errero Open Source Love Project-Status:Active LinuxMint CRAN-status Downloads

makePalette is a package containing functions that allow you to create your own color palette from an image, using mathematical algorithms.

Installation ⏬

Install makePalette from CRAN:

install.packages("makePalette")

Usage 💪

library(makePalette)

You need an image in jpg, png, tiff or similar format, stored in the hard disk of your PC or in some url.

Examples with the makePaletteCLARA function (Clustering Large Applications)

Example 1

url1 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture01.jpeg"
curl::curl_download(url1, "picture01.jpeg")
colors <- makePaletteCLARA("picture01.jpeg")
barplot(1:length(colors), col=colors)

By default, the function will return a palette of 4 colors.

If you want a palette with more colors, just specify it in the n parameter.

colors <- makePaletteCLARA("picture01.jpeg", n = 10)
barplot(1:length(colors), col=colors)

Example 2

url3 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture03.jpeg"
curl::curl_download(url3, "picture03.jpeg")
colors <- makePaletteCLARA("picture03.jpeg", n = 6)
barplot(1:length(colors), col=colors)

Example 3

url5 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture05.png"
curl::curl_download(url5, "picture05.png")
colors <- makePaletteCLARA("picture05.png", n = 6)
barplot(1:length(colors), col=colors)

Example 4

url6 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture06.png"
curl::curl_download(url6, "picture06.png")
colors <- makePaletteCLARA("picture06.png", n = 6)
barplot(1:length(colors), col=colors)

Examples with the makePaletteKM function (k-Means)

Example 5

url2 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture02.jpg"
curl::curl_download(url2, "picture02.jpg")
colors <- makePaletteKM("picture02.jpg", n = 10)
barplot(1:length(colors), col=colors)

Example 6

url4 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture04.tiff"
curl::curl_download(url4, "picture04.tiff")
colors <- makePaletteKM("picture04.tiff", n = 6)
barplot(1:length(colors), col=colors)

Example 7

url6 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture06.png"
curl::curl_download(url6, "picture06.png")
colors <- makePaletteKM("picture06.png", n = 6)
barplot(1:length(colors), col=colors)


About

It's a package containing functions that allow you to create your own color palette from an image, using mathematical algorithms

Topics

Resources

Stars

Watchers

Forks

Languages