-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.js
More file actions
45 lines (30 loc) · 811 Bytes
/
index.js
File metadata and controls
45 lines (30 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function processImage (img) {
// img.height, .width, .data [r,g,b,a,r,g,b,a...]
copy(img)
}
function copy (img) {
return img;
}
function transparent (img) {}
function tintRed (img) {}
function greyscale (img) {}
function invertColors (img) {}
function flipVertical (img) {}
function flipHorizontal (img) {}
function rotate90 (img) {}
function blur (img, blurFactor) {}
// DON'T MESS WITH WHAT'S BELOW
var fs = require('fs')
var path = require('path')
Png = require('node-png').PNG;
var date = Date.now()
var inputFilePath = './images/rainbowSheep.png'
var outputFilePath = './images/out/'+String(date)+'.png'
fs.createReadStream(inputFilePath)
.pipe(new Png({
filterType: 4
}))
.on('parsed', function() {
processImage(this)
this.pack().pipe(fs.createWriteStream(outputFilePath));
});