goal of this project is write JS implemntation MMCQ in python.
See more at Color quantization using modified median cut by Dan S. Bloomb
To get sample palette, you can use mmcq.get_palette.
from mmcq import get_palette
from PIL import Image, ImageDraw
# create an image
out = Image.new("RGB", (1000, 1000), (255, 255, 255))
d = ImageDraw.Draw(out)
with get_palette('something.jpg', 8) as palette:
for i, color in enumerate(palette):
d.rectangle((((i - 1) * 100, 0), (i * 100, 100)), fill=color)
out.show()
To get dominant color, you can use mmcq.get_dominant_color which color is frist of mmcq.get_palette.
>>> from mmcq import get_dominant_color
>>> get_dominant_color(filename='/image/something.jpg')
(255, 234, 0)
See more at Color thief.
To be released.
- Use setup.cfg to configure project.
- Only Python3 support.
- Default image library changed from Wand to Pillow.