Comments (10)
var palette2 = new Uint8Array( 32 * 3 );
Seems to work fine. From what I saw in my test your palette was 24 colors.
Sorry, I will try to clarify the code up a bit. There is two different aspects.
- GIF format enforces a palette of power of 2 (8, 16, 32, 64, etc) number of colors.
- omggif takes 3 arrays elements for each color in the palette [r, g, b, r, g, b, ...]. This could (and maybe should / will) be changed to [rgb, rgb, ...].
So for now really what you need is palette.length / 3 to be a power of 2. omggif checks for both of those things.
So what you really want is to pass omggif something like 64*3, 32 * 3, etc, since there are separate elements for RGB.
I just wrote this code today, now that you mention it I will probably change the palettes to be RGB together, it's a bit more convenient when you are writing things out by hand to (0xff78fa vs 0xff, 0x78, 0xfa) and it means less array elements which is probably not a bad thing.
Hope that helps
from omggif.
Oh damn. I was missing the * 3...
So now it kind of works:
https://gist.github.com/4582927
It shows the top half of the gif fine, the second half gets corrupted.
from omggif.
I have a look at it tomorrow, thanks for the code to reproduce
from omggif.
I think it should be fixed in 99faac4.
from omggif.
Cool! Works fine now :)
from omggif.
Some tests:
from omggif.
I just spent a few hours optimizing (yesterday I just wrote the naive initial implementation). There is about a 4x performance increase in the LZW compressor. It made the code slightly trickier, so let me know if you see any problems. I will spend a little bit more time looking at optimizations, although I've tried a few and I think I am pretty close to the balance of making the code very ugly for only helping a few percent.
PS: Thanks for the examples! It works! ; )
from omggif.
Wow. It's much faster compared to this morning. It's almost realtime now.
http://mrdoob.com/lab/javascript/omggif/
from omggif.
I just pushed another improvement of 15%, but it's getting to the manually unrolled/inlined point, so I think I'll call it good for now. Overall it's about 5x yesterday's code.
from omggif.
Impressed
from omggif.
Related Issues (20)
- Implement streaming HOT 12
- Please add license file HOT 2
- Disposal method 2 not supported HOT 2
- Combine frames with transparency HOT 3
- Quantization and efficient frame encoding
- Are you accepting PRs? HOT 4
- Infinite loop on truncated GIF HOT 3
- Unhelpful exception on exceeding buffer bounds HOT 5
- Exceptions do not include a stack trace
- Enumerate public API? HOT 3
- Blending operations in GIFs HOT 2
- Upload to bower
- Loop count when exporting GIF HOT 9
- Get global palette from GIF HOT 6
- Invalid Block Size HOT 5
- Supporting corrupted GIFs to some degree HOT 2
- Attempt to use undefined value HOT 1
- MIT license? HOT 3
- Corrupted GIF at the output HOT 4
- frame ghosting and partial frames HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omggif.