Python mmcq implementation
Project description
mmcq.py – Python implementation of Modified Median Color Quantization (MMCQ)
goal of this project is write JS implemntation MMCQ in python.
MMCQ?
See more at Color quantization using modified median cut by Dan S. Bloomb
Usage
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.
Changelog
0.1.0
Only Python3 support.
Default image library changed from Wand to Pillow.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mmcq.py-0.1.1.tar.gz
(5.2 kB
view hashes)