There are fancy ways to extract colours from images but sometimes it’s easier if you could simply click on the image and choose the colours you want.
eyedroppeR you can click on an image to return the hex codes of the selected pixels all within R.
Install from GitHub.
You may also need to install
install.packages("ggchicklet", repos = "https://cinc.rud.is")
For more info follow the link to the GitHub repo.
eyedropper with the following steps:
- Find the image you want to pick colours from online.
- Right-click and ‘copy image address’.
- Choose how many colours to pick e.g.
n = 5.
pal <- eyedropper(n = 5).
eyedropperwill read the copied address from the clipboard if
img_pathis left as NULL
- If you have a local file or a saved
pathyou can reference it directly with
pal <- eyedropper(n = 5, img_path = path)
- Click the 5 desired colours. The image will be stretched to the borders of the window, but that’s OK.
- Done! Copy the returned string and add it to your script and start using
sort_pal: allows you to manually sort a palette by clicking on the colours in order. It also allows you to select a specified number of colours if you don’t want them all.
extract_pal: automatically selects a specified number of colours using a clustering algorithm. It will read the image path from the clipboard as well and allow you to sort the colours after they are extracted.
show_pal: Simple helper to display the palette.