Color quantization: Difference between revisions
m
Don't deduplicate colors/pixels
(Add Common Lisp implementation) |
m (Don't deduplicate colors/pixels) |
||
Line 139:
(defun image->pixels (image)
(check-type image 8-bit-rgb-image)
(let
(do-pixels (y x) image
(
(defun greatest-color-range (pixels)
Line 164 ⟶ 163:
(defun median-cut (pixels target-num-colors)
(assert (zerop (mod (log target-num-colors 2) 1)))
(if (or (= target-num-colors 1) (
(list pixels)
(let* ((channel (greatest-color-range pixels))
Line 174 ⟶ 173:
(defun quantize-colors (pixels target-num-colors)
(
(dolist
(dolist
(defun quantize-image (input-file output-file target-num-colors)
|