wowowowowowowo so much stuff
1
art/museum/to_process/art.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"snow_in_winter":{"red":"processed/snow_in_winter_r.png","green":"processed/snow_in_winter_g.png","blue":"processed/snow_in_winter_b.png"},"delacroix":{"blue":"processed/delacroix_b.png","green":"processed/delacroix_g.png","red":"processed/delacroix_r.png"},"birth_of_venus":{"blue":"processed/birth_of_venus_b.png","green":"processed/birth_of_venus_g.png","red":"processed/birth_of_venus_r.png"},"saturn_son":{"green":"processed/saturn_son_g.png","blue":"processed/saturn_son_b.png","red":"processed/saturn_son_r.png"}}
|
||||
BIN
art/museum/to_process/birth_of_venus.jpg
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
art/museum/to_process/cropped/birth_of_venus.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
art/museum/to_process/cropped/delacroix.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
art/museum/to_process/cropped/lisa.jpg
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
art/museum/to_process/cropped/lisa.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
art/museum/to_process/cropped/palette
Normal file
|
After Width: | Height: | Size: 867 B |
BIN
art/museum/to_process/cropped/pearl_earing.jpg
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
art/museum/to_process/cropped/pearl_earing.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
art/museum/to_process/cropped/processed/birth_of_venus_b.png
Normal file
|
After Width: | Height: | Size: 786 B |
BIN
art/museum/to_process/cropped/processed/birth_of_venus_g.png
Normal file
|
After Width: | Height: | Size: 806 B |
BIN
art/museum/to_process/cropped/processed/birth_of_venus_r.png
Normal file
|
After Width: | Height: | Size: 808 B |
|
After Width: | Height: | Size: 1.4 KiB |
BIN
art/museum/to_process/cropped/processed/delacroix_b.png
Normal file
|
After Width: | Height: | Size: 583 B |
BIN
art/museum/to_process/cropped/processed/delacroix_g.png
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
art/museum/to_process/cropped/processed/delacroix_r.png
Normal file
|
After Width: | Height: | Size: 617 B |
BIN
art/museum/to_process/cropped/processed/delacroix_reduced.png
Normal file
|
After Width: | Height: | Size: 939 B |
BIN
art/museum/to_process/cropped/processed/lisa_b.png
Normal file
|
After Width: | Height: | Size: 566 B |
BIN
art/museum/to_process/cropped/processed/lisa_g.png
Normal file
|
After Width: | Height: | Size: 534 B |
BIN
art/museum/to_process/cropped/processed/lisa_r.png
Normal file
|
After Width: | Height: | Size: 524 B |
BIN
art/museum/to_process/cropped/processed/lisa_reduced.png
Normal file
|
After Width: | Height: | Size: 843 B |
BIN
art/museum/to_process/cropped/processed/pearl_earing_b.png
Normal file
|
After Width: | Height: | Size: 403 B |
BIN
art/museum/to_process/cropped/processed/pearl_earing_g.png
Normal file
|
After Width: | Height: | Size: 432 B |
BIN
art/museum/to_process/cropped/processed/pearl_earing_r.png
Normal file
|
After Width: | Height: | Size: 422 B |
BIN
art/museum/to_process/cropped/processed/pearl_earing_reduced.png
Normal file
|
After Width: | Height: | Size: 563 B |
BIN
art/museum/to_process/cropped/processed/saturn_son_b.png
Normal file
|
After Width: | Height: | Size: 991 B |
BIN
art/museum/to_process/cropped/processed/saturn_son_g.png
Normal file
|
After Width: | Height: | Size: 910 B |
BIN
art/museum/to_process/cropped/processed/saturn_son_r.png
Normal file
|
After Width: | Height: | Size: 886 B |
BIN
art/museum/to_process/cropped/processed/saturn_son_reduced.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
art/museum/to_process/cropped/processed/van_gogh_b.png
Normal file
|
After Width: | Height: | Size: 626 B |
BIN
art/museum/to_process/cropped/processed/van_gogh_g.png
Normal file
|
After Width: | Height: | Size: 674 B |
BIN
art/museum/to_process/cropped/processed/van_gogh_r.png
Normal file
|
After Width: | Height: | Size: 641 B |
BIN
art/museum/to_process/cropped/processed/van_gogh_reduced.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
art/museum/to_process/cropped/saturn_son.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
art/museum/to_process/cropped/van_gogh.jpg
Normal file
|
After Width: | Height: | Size: 246 KiB |
BIN
art/museum/to_process/cropped/van_gogh.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
art/museum/to_process/delacroix.jpg
Normal file
|
After Width: | Height: | Size: 190 KiB |
BIN
art/museum/to_process/palette
Normal file
|
After Width: | Height: | Size: 867 B |
141
art/museum/to_process/pixelate.js
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
var gm = require('gm').subClass({ imageMagick: true });
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
|
||||
var imageTypes = [".png", ".jpg", ".jpeg", ".bmp"]
|
||||
|
||||
if (typeof process.argv[3] === 'undefined')
|
||||
outDirectory = "processed/";
|
||||
else
|
||||
outDirectory = process.argv[3];
|
||||
|
||||
var inDirectory = process.argv[2];
|
||||
var outDirectory;
|
||||
var palette = "palette"
|
||||
var channels = ["Red", "Green", "Blue"]
|
||||
|
||||
var objToSerialize = {
|
||||
//format:
|
||||
|
||||
//name_of_picture: filename
|
||||
}
|
||||
|
||||
|
||||
var ratio = function(x, y) {
|
||||
var div = x / y;
|
||||
|
||||
var newRatio;
|
||||
if (1.333 < div < 1.666) {
|
||||
newRatio = 1.5
|
||||
}
|
||||
else {
|
||||
newRatio = Math.max(Math.min(Math.round(div), 3), 1)
|
||||
}
|
||||
|
||||
var newX = y * newRatio;
|
||||
|
||||
if ( newX < x) {
|
||||
x = newX;
|
||||
}
|
||||
else {
|
||||
y = x / newRatio;
|
||||
}
|
||||
|
||||
return [x, y, newRatio]
|
||||
}
|
||||
|
||||
fs.readdir(inDirectory, function(err, files) {
|
||||
files.forEach(function(file) {
|
||||
if ( imageTypes.indexOf(path.extname(file)) > -1 ) {
|
||||
|
||||
//lets put the filename in an object
|
||||
var filename = file.split(".")[0]
|
||||
|
||||
function processImage(filename, callbac, color) {
|
||||
var img = gm(filename);
|
||||
|
||||
var w; var h; var w_off; var h_off;
|
||||
var ar_w; var ar_h;
|
||||
var r;
|
||||
var scale_w; var scale_h;
|
||||
|
||||
|
||||
img.size(function(err, value) {
|
||||
if (value) {
|
||||
w = value.width; h = value.height;
|
||||
if (w > h) {
|
||||
var res = ratio(w, h)
|
||||
ar_w = res[0];
|
||||
ar_h = res[1];
|
||||
r = res[2];
|
||||
|
||||
scale_w = 48 * r;
|
||||
scale_h = 48;
|
||||
}
|
||||
else {
|
||||
var res = ratio(h, w);
|
||||
ar_w = res[1];
|
||||
ar_h = res[0];
|
||||
r = res[2];
|
||||
scale_w = 48;
|
||||
scale_h = 48 * r;
|
||||
}
|
||||
if (w > ar_w) {
|
||||
w_off = (w - ar_w) / 2;
|
||||
h_off = 0;
|
||||
}
|
||||
else if (h > ar_h) {
|
||||
w_off = 0;
|
||||
h_off = (h - ar_h) / 2
|
||||
}
|
||||
else {
|
||||
w_off = 0; h_off = 0;
|
||||
}
|
||||
console.log(r);
|
||||
}
|
||||
callbac({
|
||||
img: img, color: color, w: w, h: h, w_off: w_off, h_off: h_off, ar_w: ar_w,
|
||||
ar_h: ar_h, scale_w: scale_w, scale_h: scale_h
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function cropScaleMap(obj) {
|
||||
obj.img.crop(obj.ar_w, obj.ar_h, obj.w_off, obj.h_off)
|
||||
.scale(obj.scale_w, obj.scale_h)
|
||||
// .map(palette)
|
||||
// .dither(true)
|
||||
// .channel(obj.color)
|
||||
.write(outDirectory + filename + "_" + obj.color.charAt(0).toLowerCase() + ".png", function(err) {
|
||||
|
||||
// console.log(err);
|
||||
// console.log(outDirectory + filename + "_" + obj.color.charAt(0).toLowerCase() + ".png")
|
||||
// var col = obj.color.toLowerCase()
|
||||
// if (objToSerialize[filename]) {
|
||||
// objToSerialize[filename][col] = outDirectory + filename + "_" + obj.color.charAt(0).toLowerCase() + ".png"
|
||||
// }
|
||||
// else {
|
||||
// objToSerialize[filename] = {}
|
||||
// objToSerialize[filename][col] = outDirectory + filename + "_" + obj.color.charAt(0).toLowerCase() + ".png"
|
||||
// }
|
||||
// fs.writeFile('art.json', JSON.stringify(objToSerialize), function(err) {
|
||||
// if (err) throw err;
|
||||
// console.log("wowwwww");
|
||||
// });
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//do the stuff
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
// var c = channels[i];
|
||||
// var c_abb = channels[i].charAt(0).toLowerCase();
|
||||
|
||||
processImage(file, cropScaleMap, channels[i])
|
||||
}
|
||||
}
|
||||
});
|
||||
var s = JSON.stringify(objToSerialize);
|
||||
console.log(s)
|
||||
});
|
||||
|
||||
BIN
art/museum/to_process/processed/adam_b.png
Normal file
|
After Width: | Height: | Size: 485 B |
BIN
art/museum/to_process/processed/adam_g.png
Normal file
|
After Width: | Height: | Size: 495 B |
BIN
art/museum/to_process/processed/adam_r.png
Normal file
|
After Width: | Height: | Size: 498 B |
BIN
art/museum/to_process/processed/adam_reduced.png
Normal file
|
After Width: | Height: | Size: 678 B |
BIN
art/museum/to_process/processed/david_b.png
Normal file
|
After Width: | Height: | Size: 672 B |
BIN
art/museum/to_process/processed/david_g.png
Normal file
|
After Width: | Height: | Size: 687 B |
BIN
art/museum/to_process/processed/david_r.png
Normal file
|
After Width: | Height: | Size: 698 B |
BIN
art/museum/to_process/processed/david_reduced.png
Normal file
|
After Width: | Height: | Size: 953 B |
BIN
art/museum/to_process/processed/david_small_b.png
Normal file
|
After Width: | Height: | Size: 437 B |
BIN
art/museum/to_process/processed/david_small_g.png
Normal file
|
After Width: | Height: | Size: 437 B |
BIN
art/museum/to_process/processed/david_small_r.png
Normal file
|
After Width: | Height: | Size: 439 B |
BIN
art/museum/to_process/processed/david_small_reduced.png
Normal file
|
After Width: | Height: | Size: 522 B |
BIN
art/museum/to_process/processed/lilypond_b.png
Normal file
|
After Width: | Height: | Size: 794 B |
BIN
art/museum/to_process/processed/lilypond_g.png
Normal file
|
After Width: | Height: | Size: 805 B |
BIN
art/museum/to_process/processed/lilypond_r.png
Normal file
|
After Width: | Height: | Size: 817 B |
BIN
art/museum/to_process/processed/lilypond_reduced.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
art/museum/to_process/processed/starry_b.png
Normal file
|
After Width: | Height: | Size: 637 B |
BIN
art/museum/to_process/processed/starry_g.png
Normal file
|
After Width: | Height: | Size: 611 B |
BIN
art/museum/to_process/processed/starry_r.png
Normal file
|
After Width: | Height: | Size: 568 B |
BIN
art/museum/to_process/processed/starry_reduced.png
Normal file
|
After Width: | Height: | Size: 1,018 B |
BIN
art/museum/to_process/processed/venus_b.png
Normal file
|
After Width: | Height: | Size: 415 B |
BIN
art/museum/to_process/processed/venus_g.png
Normal file
|
After Width: | Height: | Size: 439 B |
BIN
art/museum/to_process/processed/venus_r.png
Normal file
|
After Width: | Height: | Size: 439 B |
BIN
art/museum/to_process/processed/venus_reduced.png
Normal file
|
After Width: | Height: | Size: 557 B |
BIN
art/museum/to_process/saturn_son.jpg
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
art/museum/to_process/snow_in_winter.jpg
Normal file
|
After Width: | Height: | Size: 113 KiB |