In C#,maybe it's a bug for Image.SaveAdd, who can help me to solve it?

后端 未结 4 1421
渐次进展
渐次进展 2020-12-17 22:54

I\'m trying to combine two different gif file into one file.

First, I learned a lot about the gif format. And I know the delay time value is set in Graphics Control

4条回答
  •  不思量自难忘°
    2020-12-17 23:44

    This simply isn't supported by any of the .NET image encoders. Neither by GDI+ nor by WIC, the underlying native codecs for the System.Drawing.Bitmap and System.Windows.Media.Imaging.PngBitmapEncoder classes.

    While that sounds like a very strange oversight, the most probably reason was that GIF was encumbered by a software patent. Unisys owned the rights to the LZW compression algorithm and started aggressively pursuing obtaining the license fees for it. Starting at the most obvious targets where most money can be had, Microsoft is forever on the top of the list. They were not modest either, a non-commercial or private web site that used GIFs on their web pages had to cough up five thousand dollars in 1999.

    This killed the image format. Ubiquitous before this, just about everybody stopped using them. Stunningly quickly too, this only took a few months. Happily coinciding with everybody completely having their fill of animated gifs btw, it was grossly overdone before. You may find some web pages from back-then on the wayback machine where everything in the corner of eye was moving. Not the only lucky coincidence, it was the core reason for the open source PNG format being developed. Thank our lucky stars :)

    The patent expired around 2004, depending on where you live, so you won't have to fear a letter from Unisys anymore.

    Long story short, you'll have to shop around for another library to add this feature to your program. It is well-covered by this existing SO question, no need to repeat it here.

提交回复
热议问题