okaneco / kmeans-colors

k-means clustering library and binary to find dominant colors in images
Apache License 2.0
134 stars 9 forks source link

Fix indexing error for proportional palettes #8

Closed okaneco closed 4 years ago

okaneco commented 4 years ago

Palette width wasn't clamped so there was a possibility of off-by-one when working with very small percentages in proportional palettes. This became apparent when they were sorted and for large sizes.

Add flag for working with transparent images. First steps of working with handling k-means for transparent pngs. The flag is hidden and only good for finding the colors or producing a palette. It's a special case that will require more logic for outputting a full image. This will be completed with hopefully a followup change to generics.