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
BytesIO
object.Pass the
BytesIO
object 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)