Skip to main content

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


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)

Uploaded Source

Built Distribution

mmcq.py-0.1.1-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page