revisitors / writegif Goto Github PK
View Code? Open in Web Editor NEWWrites a gif from the image format provided by http://npm.im/readimage
License: MIT License
Writes a gif from the image format provided by http://npm.im/readimage
License: MIT License
It's hard for me to narrow down if this is a problem with writegif or with readimage, but I've noticed that while unaltered meatspace GIFs come out of readimage/writegif perfectly, a lot of other GIFs come through with strange pixel artifacting.
Simplest reproduction:
function makeDataUri(type, buffer) {
return 'data:' + type + ';base64,' + buffer.toString('base64');
}
function imgTag(image) {
return "<img src='" + makeDataUri("image/gif", image) + "' />";
}
// readimage/writegif no-op
function writegiftest(buffer, cb) {
readimage(buffer, function (err, buf) {
writegif(buf, cb);
});
}
// Express.js route
app.get("/writegiftest", function (req, res) {
fs.readFile("./gifs/example.gif", function (err, buffer) {
if (err) {
res.send(err);
return;
}
writegiftest(buffer, function (err, image) {
res.send(imgTag(image));
});
});
You can see two examples below, one is a Photoshop-resized meatspace GIF, the other is just a GIF of Homer Simpson from GIS.
Getting a segfault with Node 0.10.31, OSX 10.9.4, using the basic readimage + writegif example. Don't know if this is useful but here's the result from node-segfault-handler:
. | . | . |
---|---|---|
0 | segfault_handler.node | 0x0000000100afb49f _ZL16segfault_handleriP9__siginfoPv + 287 |
1 | libsystem_platform.dylib | 0x00007fff82ac35aa _sigtramp + 26 |
2 | ??? | 0x0000000000000008 0x0 + 8 |
3 | node | 0x00000001002293c0 _ZN2v88internal17BoundsCheckBbData10CoverCheckEPNS0_12HBoundsCheckEi + 192 |
4 | node | 0x00000001001f86e4 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 308 |
5 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
6 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
7 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
8 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
9 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
10 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
11 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
12 | node | 0x00000001001f8854 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEPNS0_11HBasicBlockEPNS0_16BoundsCheckTableE + 676 |
13 | node | 0x00000001001f7e55 _ZN2v88internal6HGraph30EliminateRedundantBoundsChecksEv + 229 |
14 | node | 0x00000001001f7d48 _ZN2v88internal6HGraph8OptimizeEPNS0_17SmartArrayPointerIcEE + 1192 |
15 | node | 0x000000010015d24a _ZN2v88internal18OptimizingCompiler13OptimizeGraphEv + 42 |
16 | node | 0x000000010015fa16 _ZN2v88internalL12GenerateCodeEPNS0_15CompilationInfoE + 134 |
17 | node | 0x000000010015e694 _ZN2v88internal8Compiler11CompileLazyEPNS0_15CompilationInfoE + 404 |
18 | node | 0x00000001002a5322 _ZN2v88internal10JSFunction16CompileOptimizedENS0_6HandleIS1_EENS0_9BailoutIdENS0_18ClearExceptionFlagE + 162 |
19 | node | 0x00000001003188e4 _ZN2v88internal36Runtime_CompileForOnStackReplacementENS0_9ArgumentsEPNS0_7IsolateE + 644 |
20 | ??? | 0x00001f7784e06362 0x0 + 34598190867298 |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.