File: README.md

package info (click to toggle)
golang-github-marekm4-color-extractor 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208 kB
  • sloc: makefile: 5
file content (46 lines) | stat: -rw-r--r-- 1,251 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Simple image color extractor written in Go with no external dependencies.

[![Go Reference](https://pkg.go.dev/badge/github.com/marekm4/color-extractor.svg)](https://pkg.go.dev/github.com/marekm4/color-extractor)
[![Go Report Card](https://goreportcard.com/badge/github.com/marekm4/color-extractor)](https://goreportcard.com/report/github.com/marekm4/color-extractor)
[![Go Coverage](https://github.com/marekm4/color-extractor/wiki/coverage.svg)](https://raw.githack.com/wiki/marekm4/color-extractor/coverage.html)

Demo:

https://color-extractor-demo.marekm4.com/

Blog post:

https://medium.com/@marek.michalik/c-vs-rust-vs-go-performance-analysis-945ab749056c

Usage:
```go
package main

import (
	"fmt"
	"image"
	_ "image/jpeg"
	"os"

	"github.com/marekm4/color-extractor"
)

func main() {
	file := "Fotolia_45549559_320_480.jpg"
	imageFile, _ := os.Open(file)
	defer imageFile.Close()

	image, _, _ := image.Decode(imageFile)
	colors := color_extractor.ExtractColors(image)

	fmt.Println(colors)
}
```

Example image:

![Image](https://raw.githubusercontent.com/marekm4/color-extractor/master/example/Fotolia_45549559_320_480.jpg)

Extracted colors:

![Colors](https://raw.githubusercontent.com/marekm4/color-extractor/master/example/colors.png)