Пример #1
0
        private static void GifCoderTest()
        {
            var _gifFileName = "F_LAW.gif";

            var _input = new FileStream(_gifFileName, FileMode.Open);

            var _gifCoder = new GifBitmapCoder();

            _gifCoder.Load(_input);
            _input.Close();

            for (int i = 0; i < _gifCoder.Frames.Count; i++)
            {
                var _output  = String.Format(@"result\{0}{1:d3}.gif", Path.GetFileNameWithoutExtension(_gifFileName), i);
                var _encoder = new GifBitmapEncoder();
                _encoder.Frames.Add(_gifCoder.Frames[i].Frame);

                using (var _fs = new FileStream(_output, FileMode.Create))
                {
                    _encoder.Save(_fs);
                }
            }

            var _output1 = new FileStream("output.gif", FileMode.Create);

            _gifCoder.Save(_output1);
            _output1.Close();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //var _gifFileName = "truck_crush.gif";
            var _gifFileName = "football.gif";

            var _gifCoder = new GifBitmapCoder();
            var _input    = new FileStream(_gifFileName, FileMode.Open);

            _gifCoder.Load(_input);

            _input.Close();

            for (int i = 0; i < _gifCoder.Frames.Count; i++)
            {
                _gifCoder.Frames[i].Delay = 1 + i % 31;
                //_gifCoder.Frames[i].Delay = 11;

                var _encoder = new BmpBitmapEncoder();
                _encoder.Frames.Add(_gifCoder.Frames[i].Frame);

                string _file = String.Format(@"result\output{0}.bmp", i);
                var    _fs   = new FileStream(_file, FileMode.Create);
                _encoder.Save(_fs);
                _fs.Close();
            }

            var _outputFileName = "football_slow_mo.gif";
            //var _outputFileName = "truck_crush.gif";
            var _output = new FileStream(_outputFileName, FileMode.Create);

            _gifCoder.Save(_output);

            _output.Close();
        }
Пример #3
0
        private static void DisposalMethodTest()
        {
            // var _fileName = "SpartanFla.gif";
            var _fileName = "output.gif";

            var _input = new FileStream(_fileName, FileMode.Open);

            var _gifCoder = new GifBitmapCoder();

            _gifCoder.Load(_input);
            _input.Close();

            foreach (var _frame in _gifCoder.Frames)
            {
                // _frame.DisposalMethod = GifFrameDisposalMethod.RestoreToPrevious;
                _frame.DisposalMethod = GifFrameDisposalMethod.NotDispose;
            }

            var _output = new FileStream("output.gif", FileMode.Create);

            _gifCoder.Save(_output);
            _output.Close();
        }