by David SchmuddeOct 10 2019
Turing complete.
Remix of Python by Nextjournal

Color Palette Extractor

This article installs dependencies and establishes the basic functionality of color extraction from an image.

Install Dependencies

pip install --upgrade pip
pip install haishoku pillow


from haishoku.haishoku import Haishoku
from PIL import Image

def new_image(mode, size, color):
    return, size, color)

path = 
# path = "" # getPalette api palette = Haishoku.getPalette(path) # getDominant api # dominant = Haishoku.getDominant(path) # showPalette api # Haishoku.showPalette(path) # showDominant api dominantImage = Haishoku.showDominant(path) # Haishoku object h = Haishoku.loadHaishoku(path) dominantColor = new_image('RGB', (100, 100), h.dominant)"/results/dominateColor.jpg", "JPEG")