Skip to content

Instantly share code, notes, and snippets.

View adammathes's full-sized avatar

Adam Mathes adammathes

View GitHub Profile

Keybase proof

I hereby claim:

  • I am adammathes on github.
  • I am abm (https://keybase.io/abm) on keybase.
  • I have a public key ASAY8Ce9szTyZCZAau77H_yGulmt41TUsbyepjfn9JrcXwo

To claim this, I am signing this object:

@adammathes
adammathes / generate_clut.py
Created August 17, 2013 19:07
Given an input image color palette, extracts all colors from it and generates a color lookup table texture suitable for use with GPUImageLookupFilter of using closest color logic.
#!/usr/bin/python
from PIL import Image, ImageColor
import math
import sys
def closest_color(incolor, colors):
distances = []
min_distance = 10000
for color in colors: