GithubHelp home page GithubHelp logo

mrousavy / animatedgif Goto Github PK

View Code? Open in Web Editor NEW
147.0 147.0 43.0 1.6 MB

:vhs: A high performance .NET library for reading and creating animated GIFs

License: GNU General Public License v3.0

C# 100.00%
animated create decoder decoding encoder encoding gif library load

animatedgif's Introduction

animatedgif's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

animatedgif's Issues

GifQuality funciton is fault

gif.AddFrame(img1, delay: -1) //is good

gif.AddFrame(img1, delay: -1, quality: GifQuality.Bit8); //output.Pixels[index] = pixelValue; error massge:System.NullReferenceException

Alpha doesn't work

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

An in memory option would be nice

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

Remove Icon.ico from Nuget package and .DLL

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

Delay byte calculation

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?

Performance is slow

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!

Cross platform support?

Hey, just wondering if this relies on Win32 specific code or if this works on all supported platforms? It's dependencies seem Win32 specific.

image

I'll test it when I get chance and update this issue...

Question about frame comparision

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?

ObjectDisposedException in Finish()

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.

Optimizing gif size using transparency ?

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.

No Loop

Is it possible to not loop the created gif?

Publish the new version to nuget

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

Needs more documentation

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.

Frame Delays below 20ms do not work

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

Stitching images of different resolutions doesn't sync the size

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.