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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mmcq.py-0.1.1.tar.gz.
File metadata
- Download URL: mmcq.py-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a178a3ba0d847078b8d81dbd969130399caf97304e2489738b2ae1200d94e8b7
|
|
| MD5 |
34386c438b000da02536d7f090a3e4ee
|
|
| BLAKE2b-256 |
02f48815f7ff80e1fea3c39ae28f74ce830c75f30b07a8d5a602d629934c3b3a
|
File details
Details for the file mmcq.py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mmcq.py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49cc669ba3704bb3d8c56da835773992c2b05985b1940725de84f8bf404c844f
|
|
| MD5 |
7eb6ac6009c988ce1a2204a571d12ec6
|
|
| BLAKE2b-256 |
3ebfc5aa33087f4febcb253106787a872e3842b3bfce57f22e4c7d03f562c242
|