Skip to content

Averages colors in cells where color differences are below a certain threshold.

Notifications You must be signed in to change notification settings

wunderwald/AdaptiveImageQuantization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AdaptiveImageQuantization

Usage

Call quantize with the following params:

  • cell: a square that defines the region that will be quantized (x0, y0, x1, y1)
  • inputPixels: a 2d array of rgb-tuples
  • outputImage: a PIL image with dims = cell
  • thresh: the threshold for sum-of-squares deviations inside of cells
  • minCellDims: array where 0: minWidth, 1: minHeight. Smaller cells are ignored (default: 2, 2)
  • showEdges: bool, indicates wether cell edges are drawn
  • edgeType: if showEdges==true, determines the type of edges. Options: 'black' (default), 'white', 'inv', 'darken', 'lighten')

Demo

Raw

"Demo Image (raw)"

Quantized (edgeType='inv', thresh=6900, minCellDims=[6, 6])

"Demo Image (quantized)"

Quantized (edgeType='white', thresh=42000, minCellDims=[6, 6])

"Demo Image (quantized)"

Quantized (edgeType='inv', thresh=6900, minCellDims=[4, 4], secret tripp mode)

"Demo Image (quantized)"

About

Averages colors in cells where color differences are below a certain threshold.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages