mrousavy / animatedgif Goto Github PK
View Code? Open in Web Editor NEW:vhs: A high performance .NET library for reading and creating animated GIFs
License: GNU General Public License v3.0
:vhs: A high performance .NET library for reading and creating animated GIFs
License: GNU General Public License v3.0
gif.AddFrame(img1, delay: -1) //is good
gif.AddFrame(img1, delay: -1, quality: GifQuality.Bit8); //output.Pixels[index] = pixelValue; error massge:System.NullReferenceException
Something I noticed since I moved from GifBitmapEncoder is that I cannot create transparent gifs anymore. it fills everything with black. I want to have an option that fixes this :D
Any plans to add this?
Looks like it might be a pretty easy tweak.
the part of my code that picks the file names is a bit separated from where I create the files, it would be nice if I could use the library in memory w/o file I/O
The lib itself is pretty light (~64 KB)
but icon makes it ~400 KB which is pointless because icon is shown nowhere.
Please remove the Icon.ico from the .dll itself because its wasteful.
-Thanks
Would you mind sharing more detail about how you came up with the calculation of the delay time low/high byte?
buffer[4] = (byte) (delay / 10 % 0x100); // Delay time low byte
buffer[5] = (byte) (delay / 10 / 0x100); // Delay time high byte
I tested delay values between 1 and 100 where 1 should produce the fastest and 100 the slowest GIF. However, it seems the lowest possible value is 20. Values below 20 are producing a slower result than values between 20 and 99.
Do you have any clue why that is?
Attempting to create a gif with only 54 frames using the memory stream variations takes over 7 seconds with a 677x1179 frame, would like to be able to do this much faster (<2 seconds) - any thoughts on improving performance without losing image quality?
Thanks!
Could we create a gif from a video?
There is a delay parameter in the AddFrame method: AnimatedGifCreator.cs#L55 but I can't access it
Sorry for my EN
I got weird problem. The more compressed images I send to the function, the bigger the gif is at the end. It's a bit illogical. Could you maybe know what could causing that?
System.ObjectDisposedException: Cannot access a closed Stream.
at System.IO.Strategies.BufferedFileStreamStrategy.WriteByteSlow(Byte value)
at System.IO.Strategies.BufferedFileStreamStrategy.WriteByte(Byte value)
at System.IO.FileStream.WriteByte(Byte value)
at AnimatedGif.AnimatedGifCreator.Finish()
at AnimatedGif.AnimatedGifCreator.Dispose()
This occurs if the caller did this:
using var agc = AnimatedGif.Create(...);
//...write frames
agc.Dispose();
//...do something with the generated file, such as rename it
//later, variable agc goes out of scope, and gets disposed a second time triggering the exception
Personally I think there should be a public API for letting the user commit and close the file ahead of dispose, but a simple fix would be to set _stream to null after disposing.
I wonder if it's possible to create a gif that supports transparency between frames, in order to reduce size.
foreach (var img in images)
{
var delta = computeDifference(previousImg, img);
previousImg = img;
gif.AddFrame(delta);
}
The idea is to set pixels that do not change between frames as transparent.
I have tried to create such frames (setting transparent pixels to 0x00000000
) but it does not work.
Frames are indeed transparent, but each frame clear the previous one.
It's probably something as simple as setting a flag per frame or for the whole animation.
It seems a requirement is to use a global palette. Local palettes per frame and transparency as explained above seems not possible.
Is it possible to not loop the created gif?
Hi,
Your example can support different image objects, but the nuget version can't do this.
Hope you can publish new version to nuget
Thanks
The readme.md is a good start but it's really hard to find more efficient use with what's available in the library without having documentation on how to use it to its full.
It defaults to something like 100ms under 20ms
It would be nice to set it lower for 60 FPS gifs
I may take a look into it in a few days myself
why?
If two images of different resolutions are used for creating a gif, the image with smaller resolution gets displayed in a shrunk size in the GIF, with rest of the space covered in white color.
This makes the GIF experience not so good.
It would be great if there is a way to match the image sizes while stitching them together!
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.