Skip to content

se7entyse7en/image-quantizer

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Image Quantizer

Color Image Quantization

Perform color quantization by selecting the palette randomly or using K-means.

Environment

Setup the environment using conda:

conda env create -f environment.yml

Sample Usage

Here's a sample usage that displays the output of the color quantization performed on the same image using random selection and K-means:

from image_quantizer import quantizer

q = quantizer.ImageQuantizer()

qimages = q.quantize_multi([
    {'n_colors': 8, 'method': 'random'},
    {'n_colors': 16, 'method': 'random'},
    {'n_colors': 32, 'method': 'random'},
    {'n_colors': 8, 'method': 'kmeans'},
    {'n_colors': 16, 'method': 'kmeans'},
    {'n_colors': 32, 'method': 'kmeans'}
], image_filename='tests/fixtures/Lenna.png')

quantizer.compare(*qimages)

The output will be something as follows:

demo FOSSA Status

License

FOSSA Status

About

Color image quantization

Resources

License

Stars

Watchers

Forks

Packages

No packages published