Skip to main content

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.

Metadata

Release files for mmcq.py 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mmcq.py 0.1.1
File Size Uploaded
mmcq.py-0.1.1.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mmcq.py 0.1.1
File Interpreter ABI Platform
mmcq.py-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / mmcq.py-0.1.1.tar.gz

Download URL mmcq.py-0.1.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a178a3ba0d847078b8d81dbd969130399caf97304e2489738b2ae1200d94e8b7
BLAKE2b-256 checksum
How to use checksums
02f48815f7ff80e1fea3c39ae28f74ce830c75f30b07a8d5a602d629934c3b3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Release files / mmcq.py-0.1.1-py3-none-any.whl

Download URL mmcq.py-0.1.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49cc669ba3704bb3d8c56da835773992c2b05985b1940725de84f8bf404c844f
BLAKE2b-256 checksum
How to use checksums
3ebfc5aa33087f4febcb253106787a872e3842b3bfce57f22e4c7d03f562c242
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page