mirror of
https://github.com/IllusionMan1212/ColorX.git
synced 2026-10-24 02:12:32 +00:00
feat: add support for gifs
This commit is contained in:
@@ -12,3 +12,4 @@ Currently ColorX supports these image formats:
|
||||
- png
|
||||
- jpeg
|
||||
- webp
|
||||
- gif
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"image/color"
|
||||
_ "image/gif"
|
||||
_ "image/jpeg"
|
||||
_ "image/png"
|
||||
|
||||
@@ -99,12 +100,12 @@ func GetProminentColor(data []byte) (string, color.Color, error) {
|
||||
colorMap := calculateColorMap(img, width, height)
|
||||
|
||||
var maxColor color.Color
|
||||
maxAmmount := 0
|
||||
maxAmount := 0
|
||||
|
||||
for color, amount := range colorMap {
|
||||
if amount > maxAmmount {
|
||||
if amount > maxAmount {
|
||||
maxColor = color
|
||||
maxAmmount = amount
|
||||
maxAmount = amount
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user