This week I ported ColorWeave in Go. The original Python code extracted dominant colors from an image. I was curious to find out whether the same can be done with Go also. Since, Go is more popular to build web applications and seldom used for processing images. It has pretty good image library with lots of options. But writing 100 lines of code took me about 3-4 hours, thanks to golang’s strict type systems.
Also, I used webcolors library find the closest color from RGB value of every pixel and naming them in CSS 2.1 or CSS 3 specification. This made the job a bit easier, as I had already written the library a couple of months back. The code is pretty flexible and takes couple of parameters. It can take how many top dominant colors to show and also takes the specification the output should follow. If the user wants the base colors, then CSS 2.1 is the ideal one, CSS 3 otherwise for more shades. This is not a library and meant to be run as a standalone application. Although, it can be used a library too and can be coupled with other programs.