Extract a color palette from an image URL using Cloudflare Workers.
- Install Strawberry Perl
- Install Rust
- Install Cloudflare Wrangler
wrangler login
- Create a Cloudflare worker with name:
image-to-color-palette
; wrangler dev
to local testwrangler publish
to publish to Cloudflare
https://image-to-color-palette.mrproper.dev/{IMAGE URL}
{
"hex": ["#fbbf5f", "#1d1d1d", "#ba560a", "#8c7444", "#715c38", "#54442c", "#544434", "#463a24", "#342c24"],
"rgb": ["251,191,95", "29,29,29", "186,86,10", "140,116,68", "113,92,56", "84,68,44", "84,68,52", "70,58,36", "52,44,36"]
}
Each entry in the rgb
object is a RGB color value in the format R,G,B
.