Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
225 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var GifLib = require('gif'); | ||
var fs = require('fs'); | ||
var sys = require('sys'); | ||
var Buffer = require('buffer').Buffer; | ||
|
||
var gifStack = new GifLib.DynamicGifStack('rgba'); | ||
//gifStack.setTransparencyColor(0x00, 0x00, 0x00); | ||
|
||
function rectDim(fileName) { | ||
var m = fileName.match(/^\d+-rgba-(\d+)-(\d+)-(\d+)-(\d+).dat$/); | ||
var dim = [m[1], m[2], m[3], m[4]].map(function (n) { | ||
return parseInt(n, 10); | ||
}); | ||
return { x: dim[0], y: dim[1], w: dim[2], h: dim[3] } | ||
} | ||
|
||
var files = fs.readdirSync('./push-data'); | ||
|
||
files.forEach(function(file) { | ||
var dim = rectDim(file); | ||
var rgba = fs.readFileSync('./push-data/' + file); | ||
gifStack.push(rgba, dim.x, dim.y, dim.w, dim.h); | ||
}); | ||
|
||
gifStack.encode(function (data, dims) { | ||
fs.writeFileSync('dynamic-async.gif', data, 'binary'); | ||
|
||
sys.log("GIF located at (" + dims.x + "," + dims.y + ") with width " + | ||
dims.width + " and height " + dims.height); | ||
}); | ||
|
This file contains 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