diff --git a/assets/morphs/0.png b/assets/morphs/0.png new file mode 100644 index 0000000..d823dff Binary files /dev/null and b/assets/morphs/0.png differ diff --git a/assets/morphs/1.png b/assets/morphs/1.png new file mode 100644 index 0000000..42ab49a Binary files /dev/null and b/assets/morphs/1.png differ diff --git a/assets/morphs/2.png b/assets/morphs/2.png new file mode 100644 index 0000000..327d69c Binary files /dev/null and b/assets/morphs/2.png differ diff --git a/assets/morphs/3.png b/assets/morphs/3.png new file mode 100644 index 0000000..d5aa550 Binary files /dev/null and b/assets/morphs/3.png differ diff --git a/assets/morphs/4.png b/assets/morphs/4.png new file mode 100644 index 0000000..c5b830a Binary files /dev/null and b/assets/morphs/4.png differ diff --git a/assets/morphs/5.png b/assets/morphs/5.png new file mode 100644 index 0000000..222285b Binary files /dev/null and b/assets/morphs/5.png differ diff --git a/assets/morphs/6.png b/assets/morphs/6.png new file mode 100644 index 0000000..e2dd86f Binary files /dev/null and b/assets/morphs/6.png differ diff --git a/sketch.js b/sketch.js index 0ae83e7..b372e69 100644 --- a/sketch.js +++ b/sketch.js @@ -1,16 +1,69 @@ let img; +let morphs = []; +let count = 7; +let size = 10; +let countH = 400; +let countV = 260; + // Load the image function preload() { img = loadImage('/assets/mona-lisa.jpg'); + for (let i = 0; i < count; i++) + morphs[i] = loadImage(`/assets/morphs/${i}.png`); } function setup() { - createCanvas(400, 400); + /* + createCanvas(26*size, 40*size); + imageMode(CORNER); + for (let i = 0; i < 26; i++) { + for (let j = 0; j < 40; j++) { + image(morphs[1], i*size, j*size, size, size); + } + }*/ + + pixelDensity(1); // Display the image - img.resize(0, 400); + img.resize(0, countH); + img.filter(GRAY); + createCanvas(countV, countH); + //createCanvas(countV*size, countH*size); image(img, 0, 0); + + loadPixels(); + let pixels2d = new Array(400); + for(let i = 0; i < 400; i++){ + pixels2d[i] = new Array(260); + } + let i = 0; + let j = 0; + let str1 = ""; + for(let k = 0; k < pixels.length; k++) { + if (k%4 == 0) { + str1 += str(pixels[k]%7); + pixels2d[i][j] = pixels[k]%7; + j++; + } + if (k/4%260 == 0 && k>0) { + str1 += '\n'; + i++; + j = 0; + } + } + + console.log(pixels); + console.log(pixels2d); + + //saveStrings(str1.split('\n'), 'data.txt'); + //resizeCanvas(countV*10, countH*10) + /*imageMode(CORNER); + for (let i = 0; i < countH; i++) { + for (let j = 0; j < countV; j++) { + image(morphs[i], i*size, j*size, size, size); + } + }*/ describe('Mona lisa - by Davincci'); } \ No newline at end of file