wowowowowowowo so much stuff

This commit is contained in:
0x81c 2015-03-14 05:36:02 -04:00
parent fe21cb61e3
commit 2f40eaf000
249 changed files with 391 additions and 20 deletions

View 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"}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

View 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)
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB