-
-
Save pieter-van-prooijen/64e8b4bff0230be8133deb1e330f71ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fork this gist and provide your solution | |
(ns nonogram.core | |
(require [mikera.image.core :as image] | |
[mikera.image.dither :as dither])) | |
(defn create-matrix [image-path] | |
(let [img (-> (image/load-image image-path) | |
(image/resize 20 20) | |
(dither/dither (dither/mono-palette-function)))] | |
(for [x (range 20) y (range 20)] | |
(image/get-pixel img x y)))) | |
;; Repl output: | |
> (distinct (create-matrix "resources/banana.bmp")) | |
(4294967295 4278190080) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(ns nonogram.core
(require [mikera.image.core :as image]
[mikera.image.dither :as dither]))
(defn create-matrix [image-path](let [img %28-> %28image/load-image image-path%29
%28image/resize 20 20%29
%28dither/dither %28dither/mono-palette-function%29%29%29]
%28for [x %28range 20%29 y %28range 20%29]
%28image/get-pixel img x y%29%29))
;; repl output: