Differences¶
With fast-colorthief¶
Supports more architectures. (
pybind11vspyo3)Doesn't have a hard dependency on
numpyCode is simple compared to
fast-colorthief's CPP codebaseAutomated tooling powered by
maturinandgithub-actionsThe size of
fast-colorthiefis 52kb-60kb,compared to 500kb-700kb formodern_colorthief
With color-thief-py¶
Superior execution time (nearly 100x)
Doesn't have a hard dependency on
pillowcolor-thief's codebase is not in par with modern python versions
Parity¶
With colorthief ( python )¶
If you want to get the same output as colorthief.
Load the image with
Pillow.Save the loaded image in a
BytesIOobject.Pass the
BytesIOobject tomodern_colorthief
Code example:
import io
from PIL import Image
import modern_colorthief
path = ...
img = Image.open(path, mode="r")
image_bytes = io.BytesIO()
img.save(image_bytes, format="PNG")
dominant_color = modern_colorthief.get_color(image_bytes)
dominant_palette = modern_colorthief.get_palette(image_bytes)
With fast-colorthief ( c++ )¶
If you want to get the same output as fast-colorthief
Load the image with
Pillow.Save the loaded image in a
BytesIOobject.Pass the
BytesIOobject tomodern_colorthief
Code example:
import io
from PIL import Image
import modern_colorthief
path = ...
img = Image.open(path, mode="r")
image_bytes = io.BytesIO()
img.save(image_bytes, format="PNG")
dominant_color = modern_colorthief.get_color(image_bytes) # method same as `get_dominant_color`
dominant_palette = modern_colorthief.get_palette(image_bytes)